MDash
By Mohammad AniniLast Updated

Code and Syntax Highlighting

Explain a command, document an API, or review a source file with syntax highlighting. Add a language tag to a fenced block, or open a supported source file directly in your vault. MDash uses Shiki to highlight code while preserving the original text for copying and export.

For the surrounding document syntax, see the Markdown Guide.

Table of Contents

Inline Code

Wrap a short snippet in backticks:

Run `npm install` before the first build.

Inline code works well for commands, variable names, and paths.

If the snippet itself contains a backtick, wrap it in two backticks:

``Use `code` inside the snippet.``

Fenced Code Blocks

Use three backticks and add a language tag. For example, put this TypeScript function in a project brief:

```ts
function taskLabel(completed: boolean): string {
  return completed ? 'Complete' : 'To do';
}
```

The language tag selects the grammar. A fence without a language tag remains a plain monospace block. An unknown tag also falls back to plain code so the document remains readable.

A fenced code block is recognized only after a matching closing fence exists. Until then, MDash keeps the opening marker literal and continues rendering the following Markdown normally.

Choose Insert Code Block in the toolbar, or press Ctrl/⌘ + Alt + C while the editor is focused, to search every bundled language, enter a custom supported tag, and write or paste code beside a live highlighted preview. Place the cursor inside an existing fenced block to edit its language and source through the same modal. If the code contains triple backticks, MDash automatically uses a longer outer fence.

In workspace Preview, shared documents, and public guides, hover over a code block or press Tab until Copy Code receives focus. On a touch screen, tap the visible Copy button. If clipboard access fails, MDash selects the code so you can copy it manually.

Open Settings → View → Code in Preview to wrap long lines, show line numbers, or set the tab width. Leave wrapping off if you prefer to scroll horizontally. Copying code leaves out line numbers. Recognized code files use the same highlighting and Preview preferences as fenced code blocks. The status bar shows the detected language.

Common Language Tags

MDash supports Shiki's bundled language set. Common tags include:

LanguageTag
TypeScriptts or typescript
JavaScriptjs or javascript
Reacttsx or jsx
Pythonpython
Rustrust
Gogo
Javajava
Cc
C++cpp
C#csharp
HTMLhtml
CSScss
JSONjson
YAMLyaml
SQLsql
Shellbash or shell
PowerShellpowershell
Markdownmd or markdown
nginxnginx
Dockerfiledocker or dockerfile

Use the primary language name or a supported alias. MDash accepts recognized tags case-insensitively, so TypeScript and typescript use the same grammar. Lowercase tags are easier to scan and are the convention used in these examples. Rendering does not rewrite the tag in your stored source.

For every recognized primary tag and alias, see the complete language reference at the end of this guide.

Choose a Specific Tag or Plain Text

Choose the most specific tag when readers benefit from syntax colors, such as tsx, json, or sql. Use text when the content is console output, pseudocode, or a format without a suitable grammar. Leave the tag empty only when you deliberately want a plain monospace block.

If a specialized tag is unavailable, choose a broader compatible grammar. For example, shell is a practical fallback for an uncommon command-line language, while yaml can be useful for a configuration format with similar structure.

Examples

Use a short example that helps readers complete a task. Include the inputs, the relevant code, and the expected result in nearby prose. A complete source file can live beside the Markdown explanation; the next section shows that workflow.

TypeScript

This function trims a note's title and supplies a readable fallback for an empty title. The sample calls show both results.

interface Note {
  id: string;
  title: string;
}

function displayTitle(note: Note): string {
  return note.title.trim() || 'Untitled';
}

displayTitle({ id: 'n1', title: '  Draft notes  ' }); // 'Draft notes'
displayTitle({ id: 'n2', title: '   ' }); // 'Untitled'

Python

For a simple space-separated text sample, this returns a count of five words. It is a small Python example rather than MDash's own multilingual word counter:

def word_count(text: str) -> int:
    return len(text.split())

print(word_count("Write clearly and edit carefully."))

Shell

These commands install a project's locked dependencies, check its TypeScript types, and produce a build. Use a project with an npm lockfile and typecheck and build scripts.

npm ci
npm run typecheck
npm run build

JSON

This fictional configuration shows strings, a Boolean, and an array.

{
  "name": "example-project",
  "private": true,
  "features": ["math", "diagrams", "wiki-links"]
}

TSX

This React component displays Saved when saved is true and Saving… when it is false.

export function SaveStatus({ saved }: { saved: boolean }) {
  return <span>{saved ? 'Saved' : 'Saving…'}</span>;
}

SQL

This query shows the most recently updated active notes first. For example, if both Draft and Review are active and Review was updated later, it appears first. An archived note is excluded regardless of its date.

SELECT title, updated_at
FROM notes
WHERE archived = FALSE
ORDER BY updated_at DESC;

YAML

This example highlights a YAML block list. MDash's own frontmatter uses inline arrays for tags, such as tags: ["planning", "markdown"].

title: Project Notes
tags:
  - planning
  - markdown

Work with Code Files

Keep Markdown explanations and source files together in a project folder:

Project/
  README.md
  docs/
    Brief.md
  src/
    index.html
    styles.css
    app.js

Use this tree as an example when importing an existing project folder. Open Project/src/app.js in MDash to edit it as JavaScript and inspect its highlighted source in Preview. Add [JavaScript source](src/app.js) to Project/README.md to link to it. The file extension selects the language for a code file, while a fenced block uses its language tag.

HTML, CSS, and JavaScript files are displayed as source. MDash does not run them as a website. Use your normal development tools to execute the project. Import, Export, and Backup explains how to import a project folder and export its text files.

Theme and Layout

Highlighted colors follow the application theme. With wrapping off, long lines scroll horizontally inside the code block. Enable Wrap Code Lines in Settings > View when wrapping is easier to read. Presentation slides also allow long blocks to scroll.

Inline code is sized to sit naturally within prose. Fenced code, the editor, and code-file Preview follow the configured Text Size.

Change the Code Font

JetBrains Mono is the default. To change it, open Settings → Fonts → Code Font. The bundled fonts include Fira Code, Iosevka Charon Mono, and the Monaspace families.

Coding Ligatures

Coding ligatures combine familiar operator sequences into clearer visual symbols without changing the source text, cursor positions, copying, searching, or exported Markdown. Open Settings, choose Fonts, and use Coding Ligatures to enable or disable them independently of the selected code font.

MDash bundles its code fonts locally. The included Monaspace families, JetBrains Mono, Fira Code, and Iosevka Charon Mono support common sequences such as:

->  =>  !=  !==  ==  ===  <=  >=  ::  ...

Turn ligatures off when you want every source character to remain visually separate, especially while teaching syntax or reviewing punctuation-heavy code.

Tips

  • Add a language tag whenever you want highlighting.
  • Keep presentation examples focused so the audience can read them.
  • Copying returns the original source, not the highlighted HTML.
  • Use text for output or examples that should remain visually neutral.

Troubleshooting

  • If a fence stays plain, check the language tag spelling and remove punctuation after it.
  • If MDash does not recognize a language, it displays plain code. Use text explicitly for neutral output or choose a compatible grammar such as shell or yaml.

Annex: Complete Language Reference

Use a primary tag or one of its aliases after the opening fence.

Show All Bundled Languages and Aliases

This annex reflects Shiki 1.29.2 and includes all 218 bundled grammars.

LanguagePrimary TagAliases
1C (Enterprise)bsl1c
1C (Query)sdbl1c-query
ABAPabapNone
ActionScriptactionscript-3None
AdaadaNone
Angular HTMLangular-htmlNone
Angular TypeScriptangular-tsNone
Apache ConfapacheNone
ApexapexNone
APLaplNone
AppleScriptapplescriptNone
AraaraNone
AsciiDocasciidocadoc
ASP.NET RazorrazorNone
AssemblyasmNone
AstroastroNone
AWKawkNone
BallerinaballerinaNone
Batch Filebatbatch
BeancountbeancountNone
Berryberrybe
BibTeXbibtexNone
BicepbicepNone
BladebladeNone
CcNone
C#csharpc#, cs
C++cppc++
Cadencecadencecdc
CairocairoNone
ClarityclarityNone
Clojureclojureclj
Closure Templatessoyclosure-templates
CMakecmakeNone
COBOLcobolNone
CODEOWNERScodeownersNone
CodeQLcodeqlql
CoffeeScriptcoffeecoffeescript
Common Lispcommon-lisplisp
CoqcoqNone
CrystalcrystalNone
CSScssNone
CSVcsvNone
CUEcueNone
Cyphercyphercql
DdNone
DartdartNone
DAXdaxNone
DesktopdesktopNone
DiffdiffNone
Dockerfiledockerdockerfile
dotEnvdotenvNone
Dream Makerdream-makerNone
EdgeedgeNone
ElixirelixirNone
ElmelmNone
Emacs Lispemacs-lispelisp
ERBerbNone
Erlangerlangerl
F#fsharpf#, fs
FennelfennelNone
FishfishNone
Fluentfluentftl
Fortran (Fixed Form)fortran-fixed-formf, f77, for
Fortran (Free Form)fortran-free-formf03, f08, f18, f90, f95
GDResourcegdresourceNone
GDScriptgdscriptNone
GDShadergdshaderNone
GeniegenieNone
Gettext POpopot, potx
GherkingherkinNone
Git Commit Messagegit-commitNone
Git Rebase Messagegit-rebaseNone
GleamgleamNone
Glimmer JSglimmer-jsgjs
Glimmer TSglimmer-tsgts
GLSLglslNone
GnuplotgnuplotNone
GogoNone
GraphQLgraphqlgql
GroovygroovyNone
HackhackNone
Handlebarshandlebarshbs
HashiCorp HCLhclNone
Haskellhaskellhs
HaxehaxeNone
HjsonhjsonNone
HLSLhlslNone
HTMLhtmlNone
HTML (Derivative)html-derivativeNone
HTTPhttpNone
HXMLhxmlNone
HyhyNone
ImbaimbaNone
INIiniproperties
JavajavaNone
JavaScriptjavascriptjs
JinjajinjaNone
JisonjisonNone
JSONjsonNone
JSON LinesjsonlNone
JSON with CommentsjsoncNone
JSON5json5None
JsonnetjsonnetNone
JSSMjssmfsl
JSXjsxNone
Juliajuliajl
Kotlinkotlinkt, kts
Kustokustokql
LaTeXlatexNone
Lean 4leanlean4
LesslessNone
LiquidliquidNone
Log filelogNone
LogologoNone
LualuaNone
LuauluauNone
Makefilemakemakefile
Markdownmarkdownmd
MarkomarkoNone
MATLABmatlabNone
MDCmdcNone
MDXmdxNone
Mermaidmermaidmmd
MIPS Assemblymipsasmmips
MojomojoNone
MovemoveNone
Narrat Languagenarratnar
Nextflownextflownf
NginxnginxNone
NimnimNone
NixnixNone
nushellnushellnu
Objective-Cobjective-cobjc
Objective-C++objective-cppNone
OCamlocamlNone
PascalpascalNone
PerlperlNone
PHPphpNone
PL/SQLplsqlNone
PolarpolarNone
PostCSSpostcssNone
PowerQuerypowerqueryNone
PowerShellpowershellps, ps1
PrismaprismaNone
PrologprologNone
Protocol Buffer 3protoprotobuf
Pugpugjade
PuppetpuppetNone
PureScriptpurescriptNone
Pythonpythonpy
QMLqmlNone
QML DirectoryqmldirNone
Qt Style SheetsqssNone
RrNone
RacketracketNone
Rakurakuperl6
RegExpregexpregex
RelrelNone
reStructuredTextrstNone
RISC-VriscvNone
Rubyrubyrb
Ruby HamlhamlNone
Rustrustrs
SASsasNone
SasssassNone
ScalascalaNone
SchemeschemeNone
SCSSscssNone
ShaderLabshaderlabshader
Shellshellscriptbash, sh, shell, zsh
Shell Sessionshellsessionconsole
SmalltalksmalltalkNone
SoliditysolidityNone
SPARQLsparqlNone
Splunk Query Languagesplunkspl
SQLsqlNone
SSH Configssh-configNone
StatastataNone
Stylusstylusstyl
SveltesvelteNone
SwiftswiftNone
Systemd UnitssystemdNone
SystemVerilogsystem-verilogNone
TalonScripttalonscripttalon
TasltaslNone
TcltclNone
TempltemplNone
Terraformterraformtf, tfvars
TeXtexNone
TOMLtomlNone
TSVtsvNone
TSXtsxNone
TurtleturtleNone
TwigtwigNone
TypeScripttypescriptts
TypeScript with Tagsts-tagslit
TypeSpectypespectsp
Typsttypsttyp
VvNone
ValavalaNone
VerilogverilogNone
VHDLvhdlNone
Vim Scriptvimlvim, vimscript
Visual Basicvbcmd
VuevueNone
Vue HTMLvue-htmlNone
Vypervypervy
WebAssemblywasmNone
Wenyanwenyan文言
WGSLwgslNone
Wikitextwikitextmediawiki, wiki
Windows Registry ScriptregNone
Wolframwolframwl
XMLxmlNone
XSLxslNone
YAMLyamlyml
ZenScriptzenscriptNone
ZigzigNone