dfasm Syntax Highlighting for Obsidian#
Prerequisites#
- Obsidian v1.0+
- Shiki Highlighter plugin (v0.7.0+)
Setup#
- Install the Shiki Highlighter plugin from Obsidian's Community Plugins
- Copy
dfasm.tmLanguage.jsonfrom this directory into your vault- Recommended location:
<vault>/.obsidian/shiki-languages/dfasm.tmLanguage.json - Any vault-relative path works
- Recommended location:
- Open Shiki Highlighter plugin settings
- Set the custom languages folder path to the directory containing the grammar
(e.g.,
.obsidian/shiki-languages) - Restart Obsidian
Usage#
Use dfasm as the language identifier in fenced code blocks:
```dfasm
@system pe=2, sm=1
&c1|pe0 <| const, 3
&result|pe0 <| add
&c1|pe0 |> &result|pe0:L
```
Updating#
When the grammar is updated (e.g., after re-running the conversion script),
copy the new dfasm.tmLanguage.json to your vault and restart Obsidian.
Limitations#
The TextMate grammar cannot distinguish port numbers (:5 in &reader|pe0:5)
from literal numbers (const, 5) — both are highlighted as generic numbers.
The Sublime Text grammar (in editor/sublime/) provides this distinction for
editors that support context-stack grammars.