{"_id":"@ai-setting/vscode-markdown-languageservice","name":"@ai-setting/vscode-markdown-languageservice","dist-tags":{"latest":"0.5.0-alpha.12"},"versions":{"0.5.0-alpha.12":{"name":"@ai-setting/vscode-markdown-languageservice","description":"Markdown language service","version":"0.5.0-alpha.12","author":{"name":"Microsoft Corporation"},"license":"MIT","engines":{"node":"*"},"main":"./out/index.js","types":"./types/vscode-markdown-languageservice.d.ts","dependencies":{"@vscode/l10n":"^0.0.18","node-html-parser":"^6.1.5","picomatch":"^2.3.1","vscode-languageserver-protocol":"^3.17.1","vscode-languageserver-textdocument":"^1.0.11","vscode-uri":"^3.0.7"},"devDependencies":{"@eslint/js":"^9.11.1","@microsoft/api-extractor":"^7.31.2","@types/markdown-it":"^12.2.3","@types/mocha":"^9.1.1","@types/node":"20.x","@types/picomatch":"^2.3.0","@typescript-eslint/eslint-plugin":"^8.44.0","@typescript-eslint/parser":"^8.44.0","eslint":"^9.36.0","github-slugger":"^2.0.0","markdown-it":"^13.0.1","mkdirp":"^1.0.4","mocha":"^10.0.0","source-map-support":"^0.5.21","typescript":"^5.6.0"},"scripts":{"api-extractor":"mkdirp etc && npx api-extractor run --local","compile":"tsc -b tsconfig.json","watch":"tsc -b tsconfig.json --watch","lint":"eslint","prepublishOnly":"npm run compile && npm run api-extractor","test":"mocha -r source-map-support/register 'out/test/**/*.test.js' --ui=tdd --timeout=2000 --exit"},"repository":{"type":"git","url":"git+https://github.com/microsoft/vscode-markdown-languageservice.git"},"bugs":{"url":"https://github.com/microsoft/vscode-markdown-languageservice/issues"},"_id":"@ai-setting/vscode-markdown-languageservice@0.5.0-alpha.12","gitHead":"1894de4c74b0046a0ab9467d4558ef0d4517d287","homepage":"https://github.com/microsoft/vscode-markdown-languageservice#readme","_nodeVersion":"20.19.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-mLuZIkRa/wN5eodzspTS0TK0e+xzFqbib7Orn8qOru1FfCIiJoZ8nKgPtx8PQIwBxPDr1o6khtKLYHKn1i9gng==","shasum":"70b56cd8aec90b5280ba1a290ab425973b348212","tarball":"https://registry.npmjs.org/@ai-setting/vscode-markdown-languageservice/-/vscode-markdown-languageservice-0.5.0-alpha.12.tgz","fileCount":51,"unpackedSize":282308,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIF9oG29dsT6Bx1x4R8kU3N7RCAlH82TDLChWLxeaZsgMAiEAg1dtiBcd4onaQ/Mkyx0ZiR7sYAjIWjCYek3ltvnSMzk="}]},"_npmUser":{"name":"gddzhaokun","email":"gddzhaokun@163.com"},"directories":{},"maintainers":[{"name":"gddzhaokun","email":"gddzhaokun@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vscode-markdown-languageservice_0.5.0-alpha.12_1778311348921_0.41263288305290313"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-09T07:22:28.631Z","0.5.0-alpha.12":"2026-05-09T07:22:29.064Z","modified":"2026-05-09T07:22:29.328Z"},"maintainers":[{"name":"gddzhaokun","email":"gddzhaokun@163.com"}],"description":"Markdown language service","homepage":"https://github.com/microsoft/vscode-markdown-languageservice#readme","repository":{"type":"git","url":"git+https://github.com/microsoft/vscode-markdown-languageservice.git"},"author":{"name":"Microsoft Corporation"},"bugs":{"url":"https://github.com/microsoft/vscode-markdown-languageservice/issues"},"license":"MIT","readme":"# VS Code Markdown Language Service\n\nThe language service that powers VS Code's Markdown support, extracted so that it can be reused by other editors and tools.\n\n\n## Features\n\nThis library targets [CommonMark](https://commonmark.org). Support for other Markdown dialects and extensions is not within the scope of this project.\n\nCurrently supported language features:\n\n- Document links (clickable spans in the editor)\n\n\tSupported links include:\n\n\t- Links to headers within the current file: `[text](#header)`\n\t- Absolute and relative links to files: `[text](path/to/file.md)`\n\t- Reference links: `[text][link-name]`\n\n- Document symbols\n\n\tFinds all headers within a markdown file\n\n- Workspace symbols\n\n\tFind all headers across all markdown files in the workspace.\n\n- Folding ranges\n\n\tFolding ranges are computed for:\n\n\t- Header sections\n\t- Region sections\n\t- Lists\n\t- Block elements\n\n- Smart select (expand selection)\n\n- Completions\n\n\tSupports completions for:\n\n\t- Links to headers\n\t- Path links\n\t- Reference links\n\n- Hover previews for images and videos\n\n- Find all references\n\n\tSupports finding references to:\n\n\t- Headers\n\t- Path links\n\t- Fragments in links\n\t- Reference links\n\n- Definitions\n\n\tSupports finding definitions headers and reference links.\n\n- Renames\n\n\tSupports renaming of headers and links.\n\n- Organize link definitions.\n\n\tGroups and sorts link definitions in a file, optionally also removing unused definitions.\n\n-  Code actions\n\n\t- Extract all occurrences of a link in a file to a link definition at the bottom of the file.\n\t- Quick fixes for removing duplicated or unused link definitions.\n\n- Diagnostics (error reporting)\n\n\tSupports generating diagnostics for invalid links to:\n\n\t- References.\n\t- Header within the current file.\n\t- Files in the workspace.\n\t- Headers in other files.\n\t\n\tAlso can generate diagnostics for:\n\n\t- Unused link definitions.\n\t- Duplicate link definitions.\n\n- Update links on file rename\n\n\tGenerate an edit that updates all links when a file/directory in the workspace is renamed or moved.\n\n- (experimental) Update links when coping and pasting text between files.\n\n\n## Usage\n\nTo get started using this library, first install it into your workspace:\n\n```bash\nnpm install vscode-markdown-languageservice\n```\n\nTo use the language service, first you need to create an instance of it using `createLanguageService`. We use dependency injection to allow the language service to be used in as many contexts as possible.\n\n```ts\nimport * as md from 'vscode-markdown-languageservice';\n\n// Implement these\nconst parser: md.IMdParser = ...;\nconst workspace: md.IWorkspace = ...;\nconst logger: md.ILogger = ...;\n\nconst languageService = md.createLanguageService({ workspace, parser, logger });\n```\n\nAfter creating the service, you can ask it for the language features it supports:\n\n```ts\n// We're using the vscode-language types in this demo\n// If you want to use them, make sure to run:\n//\n//     npm install vscode-languageserver vscode-languageserver-textdocument\n//\n// However you can also bring your own types if you want to instead.\n\nimport { CancellationTokenSource } from 'vscode-languageserver';\nimport { TextDocument } from 'vscode-languageserver-textdocument';\n\nconst cts = new CancellationTokenSource();\n\n// Create a virtual document that holds our file content\nconst myDocument = TextDocument.create(\n\tURI.file('/path/to/file.md').toString(), // file path\n\t'markdown', // file language\n\t1, // version\n\t[ // File contents\n\t\t'# Hello',\n\t\t'from **Markdown**',\n\t\t'',\n\t\t'## World!',\n\t].join('\\n')\n);\n\nconst symbols = await languageService.getDocumentSymbols(myDocument, { includeLinkDefinitions: true }, cts.token);\n```\n\nSee [example.cjs](./example.cjs) for complete, minimal example of using the language service. You can run in using `node example.cjs`.\n\n\n## Additional Links\n\n- [VS Code's Markdown language server](https://github.com/microsoft/vscode/blob/main/extensions/markdown-language-features/server/)\n- [The TextMate grammar VS Code uses for Markdown syntax highlighting](https://github.com/microsoft/vscode-markdown-tm-grammar)\n\n\n## Contributing\n\nIf you're interested in contributing\n\n1. Clone this repo\n1. Install dependencies using `npm install`\n1. Start compilation using `npm run watch`\n\nYou can run the unit tests using `npm test` or by opening the project in VS Code and pressing `F5` to debug.\n","readmeFilename":"README.md","_rev":"1-58f02b8d5a973231caf84eb85d3678a2"}