Skip to content

VS Code Extension

Sebastian Skov Nielsen edited this page Aug 1, 2026 · 1 revision

VS Code Extension

Leafmark for VS Code provides a sidebar for project management and exports. It invokes @skxv/leafmark through npx; the same external tools required by the CLI are still required.

Features

  • Detect Leafmark projects and standalone Markdown sources in the workspace.
  • Display live word and character counts.
  • Show, open, add, rename, remove, and drag-reorder chapters.
  • Edit common title, author, table-of-contents, and section-numbering settings.
  • Export PDF, DOCX, HTML, or PDF + HTML.
  • Export an individual chapter.
  • Start or cancel watch mode.
  • Select and apply themes.
  • Run tool diagnostics.
  • Convert a standalone Markdown file into a Leafmark project.

Project detection

The extension recognizes projects through:

  • .leafmark/config.json
  • leafmark.json
  • _frontmatter.md

It watches Markdown, project config, frontmatter, and bibliography files for changes.

Settings behavior

When a configured frontmatter file exists, common settings are updated there. Otherwise settings are written under metadata in .leafmark/config.json. Advanced project features remain editable directly in JSON/YAML.

Exports

The extension delegates to the CLI, so output locations, format behavior, themes, HTML rendering, and errors match command-line builds. Workspace trust is required before the extension runs exports, themes, or diagnostics.

If exports fail in the extension:

  1. Open the same project in a terminal.
  2. Run pnpx @skxv/leafmark doctor.
  3. Run the equivalent export command manually.
  4. Check Troubleshooting.

Source

The extension source and package metadata live in leafmark-vscode/ in the Leafmark repository.

Clone this wiki locally