@markdownkit/lsp
v2.1.0
Published
Language Server Protocol implementation for Markdownkit - lint and format markdown with remark
Downloads
143
Maintainers
Readme
Markdownkit Language Server
A Language Server Protocol (LSP) implementation for markdown files using remark.
Features
- Real-time linting — Diagnostics from remark lint presets as you type
- Document formatting — Format on save or demand
- Code actions — Quick fixes for common issues
- MDD validation — Real-time frontmatter, directive, and document-type diagnostics for
.mddfiles - MDD preview — Generate professional HTML from
.mddcontent - Custom commands — Autoformat, draft transform, MDD preview, MDD validate
- Configuration — Uses
.remarkrcfiles - Multi-format support —
.md,.mdx,.mdc,.mdd
Installation
npm install -g @markdownkit/lspUsage
With stdio (recommended for editors)
markdownkit-lsp --stdioProgrammatic usage
import { createMarkdownkitServer } from "@markdownkit/lsp";
createMarkdownkitServer();Processor access
import { createDefaultProcessor } from "@markdownkit/lsp/processor";
const processor = createDefaultProcessor();
const result = await processor.process("# Hello World");MDD preview
import { generateMddHtml } from "@markdownkit/lsp/mdd-preview";
const html = await generateMddHtml(mddContent);Custom LSP Commands
| Command | Arguments | Description |
| ------------------------- | ----------------- | ------------------------------------------- |
| markdownkit.autoformat | [text, options] | Transform plain text → markdown |
| markdownkit.draft | [text, options] | NLP-enhanced rough text transformation |
| markdownkit.mddPreview | [content] | Generate HTML preview from MDD content |
| markdownkit.mddValidate | [content] | Validate MDD document, return result object |
Included Plugins
The default processor includes:
remark-gfm— GitHub Flavored Markdownremark-frontmatter— YAML metadataremark-mdc— Markdown Components (Nuxt Content)remark-mdd-document-structure— MDD directive processingremark-mdd-text-formatting— MDD professional typographyremark-preset-lint-recommended— Recommended lint rulesremark-preset-lint-consistent— Consistency rulesremark-preset-lint-markdown-style-guide— Style guide rules
Editor Integration
VS Code
Install the Markdownkit extension which uses this server.
Neovim
require('lspconfig').markdownkit_lsp.setup {
cmd = { 'markdownkit-lsp', '--stdio' },
filetypes = { 'markdown', 'mdx', 'mdc', 'mdd' },
}Emacs (lsp-mode)
(lsp-register-client
(make-lsp-client
:new-connection (lsp-stdio-connection '("markdownkit-lsp" "--stdio"))
:major-modes '(markdown-mode)
:server-id 'markdownkit-lsp))Configuration
Create a .remarkrc.js in your project:
export default {
settings: {
bullet: "-",
emphasis: "_",
strong: "*",
},
plugins: [
"remark-gfm",
"remark-frontmatter",
"remark-preset-lint-recommended",
],
};License
MIT
