Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@dsanders11/vscode-markdown-languageservice
Advanced tools
Changelog
0.3.0 — March 16, 2023
@vscode/l10n
package.##
.preferredMdPathExtensionStyle
configuration option to control if generated paths to Markdown files should include or drop the file extension.Readme
The language service that powers VS Code's Markdown support, extracted so that it can be reused by other editors and tools.
This library targets CommonMark. Support for other Markdown dialects and extensions is not within the scope of this project.
Currently supported language features:
Document links (clickable spans in the editor)
Supported links include:
[text](#header)
[text](path/to/file.md)
[text][link-name]
Document symbols
Finds all headers within a markdown file
Workspace symbols
Find all headers across all markdown files in the workspace.
Folding ranges
Folding ranges are computed for:
Smart select (expand selection)
Completions
Supports completions for:
Find all references
Supports finding references to:
Definitions
Supports finding definitions headers and reference links.
Renames
Supports renaming of headers and links.
Organize link definitions.
Groups and sorts link definitions in a file, optionally also removing unused definitions.
Code actions
Diagnostics (error reporting)
Supports generating diagnostics for invalid links to:
Also can generate diagnostics for:
Update links on file rename
Generate an edit that updates all links when a file/directory in the workspace is renamed or moved.
To get started using this library, first install it into your workspace:
npm install vscode-markdown-languageservice
To 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.
import * as md from 'vscode-markdown-languageservice';
// Implement these
const parser: md.IMdParser = ...;
const workspace: md.IWorkspace = ...;
const logger: md.ILogger = ...;
const languageService = md.createLanguageService({ workspace, parser, logger });
After creating the service, you can ask it for the language features it supports:
// We're using the vscode-language types in this demo
// If you want to use them, make sure to run:
//
// npm install vscode-languageserver vscode-languageserver-textdocument
//
// However you can also bring your own types if you want to instead.
import { CancellationTokenSource } from 'vscode-languageserver';
import { TextDocument } from 'vscode-languageserver-textdocument';
const cts = new CancellationTokenSource();
// Create a virtual document that holds our file content
const myDocument = TextDocument.create(
URI.file('/path/to/file.md').toString(), // file path
'markdown', // file language
1, // version
[ // File contents
'# Hello',
'from **Markdown**',
'',
'## World!',
].join('\n')
);
const symbols = await languageService.getDocumentSymbols(myDocument, { includeLinkDefinitions: true }, cts.token);
See example.cjs for complete, minimal example of using the language service. You can run in using node example.cjs
.
If you're interested in contributing
npm install
npm run watch
You can run the unit tests using npm test
or by opening the project in VS Code and pressing F5
to debug.
FAQs
Markdown language service
The npm package @dsanders11/vscode-markdown-languageservice receives a total of 6,017 weekly downloads. As such, @dsanders11/vscode-markdown-languageservice popularity was classified as popular.
We found that @dsanders11/vscode-markdown-languageservice demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.