Skip to content

Latest commit

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..

README.md

@putout/processor-markdown NPM version

Markdown, the simple and easy-to-use markup language you can use to format virtually any document.

(c) markdownguide.org

馃悐Putout processor adds ability to get JavaScript, JSX, JSON and TypeScript code from Markdown files.

Install

npm i @putout/processor-markdown -D

Config

{
    "processors": ["markdown"]
}

Usage

Processor converts markdown to JavaScript, it looks like this.

# hello

Became:

__putout_processor_markdown([
    header(1, 'hello'),
]);

Writing Putout Plugins for Markdown

The core idea

Under the hood, @putout/processor-markdown uses a small library called happy-mark to turn your document into nested function calls. A heading becomes a call to heading(...), a paragraph becomes paragraph(...), a link becomes link(...), and so on. For example, this Markdown:

# Hello world

Some *emphasis* and a [link](https://example.com).

turns into this JavaScript:

heading(1, 'Hello world');
paragraph('Some ', italic('emphasis'), ' and a ', link('link', 'https://example.com'), '.');

Rules

Checkout markdown-related rules in @putout/plugin-markdown

License

MIT