# DITA Viewer Read and edit DITA topics and maps in Obsidian. `.dita` files open in a formatted reading view and `.ditamap` files in an outline tree, as a small site with one topic per page, or as a whole book; all take their colours, fonts and heading style from whichever theme you use. Built on [`@dita-viewer/core`](https://www.npmjs.com/package/@dita-viewer/core), the same rendering engine as the [VS Code DITA Viewer](https://github.com/aREversez/VS-Code-DITA-Viewer), whose repository holds its source (`packages/core`). ![A ditamap in book view beside a DITA topic in reading view, showing tables, code blocks, the five note types and conditional-processing badges](media/dita-viewer-hero.png) ## Status **Preview and editing** of `.dita` topics and `.ditamap` maps, desktop only. Works: all topic types and specializations the core renders, `keyref` / `conkeyref` against the ditamap near the topic, `conref` / `conrefend` (including content from other files, and re-render when those change), images inside the vault, MathML, links between topics, light and dark themes, and editing the XML source with view modes (below), tag / attribute / value completion in the editor, source diagnostics (well-formedness, references to nothing, duplicate ids), Ctrl/Cmd+click on a reference to open its target, conref "jump to source" in the preview, wrap and insert commands, the `.ditamap` outline, site and book views (below), conditional processing with a `.ditaval` or hand-picked values (below), and a quick switcher for `.dita` / `.ditamap` files. Out of scope for now: Git compare and DITA-OT publishing (see the roadmap). Mobile is not supported because the core reads files through Node. ## View modes A `.dita` file opens in one of three modes, like a Markdown note; a `.ditamap` has two more. Use the button in the pane header, the pane's "more options" menu, or a command: | Mode | What you see | | --- | --- | | **Reading view** | The formatted topic, or the map outline. | | **Source mode** | The XML in an editor: syntax highlighting, line numbers, auto-closing tags and quotes, search, undo history. | | **Live preview (side by side)** | Source on the left, preview on the right. The preview updates shortly after you stop typing and keeps the last good render while the XML is invalid (an error bar says what is wrong). Scrolling or moving the caret in the source scrolls the preview to the same place; clicking an element in the preview puts the caret on its source. | | **Site view** (maps only) | One topic per page with a sidebar of the whole map. The sidebar shows nested topicheads and bookmap division labels; click a row, or use the previous/next buttons in the pane header, to change page. A cross-topic `xref` or related link to another topic in the map switches to that page and scrolls to the target (Ctrl/Cmd opens it in a tab of its own instead). The page you are on is saved with the pane, so a restart comes back to it. Right-click the page to reveal its topic's source at the clicked line. | | **Book view** (maps only) | Every topic the map references, in map order, merged into one reading page with its bookmap chapter/appendix labels. A cross-topic `xref` to another topic in the same book scrolls to that section instead of opening a file. Right-click a section to reveal that topic's source at the clicked line. | Commands (all under "DITA Viewer:"): *Reading view*, *Source mode*, *Live preview (side by side)*, *Site view* (on a map), *Book view* (on a map), *Toggle reading view and source mode*, *Wrap selection in an element*, *Insert a structure*, and *Quick switch to a DITA file*. No hotkeys are assigned; set your own under Settings → Hotkeys. Settings has the default mode for newly opened files and the live-preview delay. Each pane remembers the mode you last chose for it. In the source, Ctrl/Cmd+click an `href`, `conref` or `keyref` to open the file or key it names; in the preview, click the reuse badge on conref'd content to show where it comes from. Diagnostics underline XML errors, references that point at nothing and duplicate ids, with the message on hover and a dot in the line-number gutter. A reference is re-checked when the file or key map it depends on changes on disk, so fixing the target clears the warning without reopening the document. Edits are saved by Obsidian as for any text file, and a change to the file on disk is merged into the open editor without moving your caret. ## Completion In the source editor, completion pops up as you type: - after `<`: elements, with the usual children of the enclosing element first (`