dita-map-editing
Structurally edit a DITA map with edit_map — add, move, remove, or re-attribute topicrefs, reference-safely and formatting-preservingly. Use when asked to reorganize a map, add/remove a topicref, move a topic between sections or maps, or set topicref attributes (toc, navtitle, etc.).
- License 许可
- Apache-2.0
- 最近更新
- 2026-10-20
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- dita-map-editing
- description
- Structurally edit a DITA map with edit_map — add, move, remove, or re-attribute topicrefs, reference-safely and formatting-preservingly. Use when asked to reorganize a map, add/remove a topicref, move a topic between sections or maps, or set topicref attributes (toc, navtitle, etc.).
03 SKILL.md 正文
Edit a DITA map's structure
edit_map changes a map's <topicref> tree by splicing the source text (formatting,
comments, and untouched attributes survive) — never by re-serializing. Four ops:
set-attr, insert, remove, move.
Addressing
Target a topicref by selector: its @id (preferred — stable), else a 1-based
child-path like /1/3 (/ is the map root). Prefer @id; child-paths shift if
siblings change. The map root is a valid parent (/).
Gotchas the tool can't decide for you
mapref/keydef/glossrefare leaves — you don't nest topicrefs into a referenced submap; only the mapref itself moves. The content model rejects illegal nesting, but choose the right parent.--dry-runfirst on every move/remove. It returns the plan (files that would change) and any warnings without writing — read it before committing.- Cross-map move (
--to-map) rebases the moved subtree's@href/@conrefto the destination directory automatically, but inbound references to the moved topics are only warned about, not rewritten — check the warnings. - Remove warns, doesn't clean up. Removing a topicref leaves the topic file on
disk; if it's still referenced elsewhere the plan says so. To also delete the file
reference-safely, use [[dita-refactor]]'s
delete_file. - Don't hand-edit the map for these changes —
edit_mappreserves formatting; a manual DOM rewrite reflows the whole file.
Process
- Read the current structure (open the map /
get_outline) and pick selectors. - set-attr —
set-attr --ref <id> --name <attr> --value <v>(empty value removes it); works fornavtitle,toc,print,processing-role,chunk,collection-type,scope,type,keys,keyref,href. - insert —
insert --parent <id|/> --index <n> --type topicref|topichead|mapref --href … --navtitle …(omit--indexto append). - remove —
remove --ref <id>(dry-run first; heed inbound-ref warnings). - move —
move --ref <id> --parent <id|/> --index <n>; add--to-map <path>to move into another map. - After structural change, validate the map (and consider deep-validate via [[dita-deliverables]] to catch keyref/conref the static checks can't).
Report
The ops applied, files changed, any reference warnings (and what you did about them), and confirmation the map still validates.
04 同仓库更多 Skills
valid-skill
A valid test skill for unit testing.
wrong-name
Name does not match directory.
missing-description
暂无简介
hidden-skill
A skill hidden from model invocation.
dita-subject-schemes
Author or repair a DITA subjectScheme that governs conditional-processing attribute values (@platform, @audience, @product, @props, @otherprops), then validate content against it. Use when introducing controlled values, governing conditional content, or when validate_conditions reports controlled-value violations.
dita-shortdesc
Write SEO-friendly DITA shortdescs and abstracts — a standalone one-sentence summary that doubles as the link preview and the HTML meta description. Use when asked to add or improve a topic's description/abstract, write shortdescs, fill missing ones, or make descriptions SEO-friendly.