Skip to content

cheatmd-dev/cheatmd-vscode

Repository files navigation

CheatMD for VS Code

A lightweight VS Code extension providing editor support for CheatMD cheatsheets. Write executable Markdown documents with completion, linting, and syntax highlighting.

Features

  • Syntax Highlighting:

    • Full syntax highlighting inside HTML comments <!-- cheat ... --> blocks.
    • Highlights variable declarations (var), imports (import), exports (export), conditionals (if / fi), and chains (chain).
    • Scopes command snippets inside variable definitions with source.shell token styling.
    • Highlights variable references ($name and <name>) within Markdown fenced code blocks (e.g. bash, sh, powershell).
  • CodeLens Execution:

    • Adds a Run with CheatMD CodeLens above Markdown code fences under headings.
    • Runs cheatmd --headless and shows command output in the CheatMD output channel.
    • Prompts for CheatMD variables through VS Code input controls.
  • Linting Diagnostics:

    • Automatically runs cheatmd --lint in the background on file open and save.
    • Highlights syntax errors, duplicate exports, missing variables, unresolved imports, and chain warnings with precise editor squigglies.
    • Reports diagnostics in the VS Code Problems tab.
  • Autocompletion:

    • Suggests DSL keywords (var, import, export, chain, if, fi) when starting a line in the DSL block.
    • Auto-scans your workspace to suggest all available exported modules when completing import .
    • Suggests selector options (--header, --column, --select-column, --map, --delimiter, --multi) when typing selector options after ---.
    • Suggests all variables (locally declared and imported) when typing $ or < inside code blocks.

Requirements

CheatMD for VS Code requires the cheatmd command-line tool for linting and CodeLens execution.

After installing, make sure cheatmd is available in your system path. You can also set an absolute path in the extension settings.

Disclosures

CheatMD for VS Code starts the local cheatmd binary for linting and inline execution. It passes the current workspace path to that local command. The extension does not send telemetry, show ads, require an account, or make network requests.

Settings Configuration

The extension adds the following settings under File > Preferences > Settings > Extensions > CheatMD:

  • cheatmd.linter.enable: Enable/disable background linting (default: true).
  • cheatmd.linter.executablePath: Specify custom path to your cheatmd executable (default: "cheatmd").
  • cheatmd.linter.strict: Treat all warnings as errors (default: false).

Manual Installation

To install the packaged .vsix extension:

  1. Open VS Code.
  2. Open the Extensions sidebar (Ctrl+Shift+X).
  3. Click the ... menu in the upper-right corner of the Extensions panel.
  4. Select Install from VSIX... and choose the packaged cheatmd-0.1.0.vsix file.

About

A lightweight VS Code extension providing editor support for CheatMD cheatsheets. Write executable Markdown documents with completion, linting, and syntax highlighting.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors