Automatic and manual prose reflow for Markdown and MDX in VS Code.
This extension automatically reflows Markdown prose while typing and adds commands for manually reflowing Markdown prose and generating a table of contents from Markdown headings.
Commands
Markdown Workbench: Reflow Prosewraps plain prose paragraphs to a configurable line length.Markdown Workbench: Set Maximum Line Lengthupdates the configured prose line length.Markdown Workbench: Toggle Maximum Line Length Indicatorshows or hides the native VS Code ruler at the configured prose line length.Markdown Workbench: Set Maximum Line Length Indicator Colorupdates the ruler color using a common color name or custom hex color.Markdown Workbench: Generate Table of Contentsinserts an anchor-linked table of contents near the top of the current document.
Behavior
- Reflows the current selection when a selection exists and
markdownWorkbench.selectionOnlyWhenSelectedis enabled. - Reflows the full document when there is no selection.
- Automatically reflows the current paragraph while typing when an edited line exceeds
markdownWorkbench.maxLineLength. - Wraps prose to
100columns by default, or to the user-definedmarkdownWorkbench.maxLineLengthvalue when set. - Shows a continuous native VS Code ruler at
markdownWorkbench.maxLineLengthby default. - Synchronizes its owned ruler through language-specific
editor.rulersentries in VS Code user settings while preserving unrelated rulers. - Updates
markdownWorkbench.maxLineLengthfrom the command palette when usingMarkdown Workbench: Set Maximum Line Length. - Toggles
markdownWorkbench.showMaxLineLengthIndicatorfrom the command palette when usingMarkdown Workbench: Toggle Maximum Line Length Indicator. - Updates
markdownWorkbench.maxLineLengthIndicatorColorfrom the command palette when usingMarkdown Workbench: Set Maximum Line Length Indicator Color. - Generates a table of contents from ATX headings (
#through######) outside fenced code blocks and frontmatter. - Inserts the table of contents after frontmatter when frontmatter exists.
- Replaces a previously generated table of contents between managed markers:
<!-- markdown-workbench-toc:start -->and<!-- markdown-workbench-toc:end -->for Markdown, or{/* markdown-workbench-toc:start */}and{/* markdown-workbench-toc:end */}for MDX. - Leaves these regions unchanged:
- fenced code blocks
- indented code blocks
- ATX headings
- blockquotes
- tables
- list items and list continuation blocks
- frontmatter blocks
- MDX import/export lines and export object blocks
- JSX/HTML blocks
Settings
markdownWorkbench.maxLineLengthmarkdownWorkbench.automaticReflowmarkdownWorkbench.showMaxLineLengthIndicatormarkdownWorkbench.maxLineLengthIndicatorColormarkdownWorkbench.languagesmarkdownWorkbench.preserveListItemsmarkdownWorkbench.selectionOnlyWhenSelected
Development
npm install
npm run build
npm test
To package the extension:
npm run package
Before publishing to the VS Code Marketplace, set final values for publisher, repository,
homepage, and bugs in package.json.