@moritzrs/remark-ofm

0.0.1 • Public • Published

remark-ofm

Build NPM Version NPM Bundle Size NPM Downloads GitHub License

remark plugin to support OFM (callouts, tags, wikilinks).

What is this?

This package is a unified(remark) plugin to enable the extensions to markdown that Obsidian adds with OFM. You can use this plugin to add support for parsing and serializing them. For full support you should combine it with other packages like 'remark-gfm'.

When to use this

This project is useful if you want to support OFM in your markdown.

If you just want to turn markdown into HTML (with maybe a few extensions such as GFM), we recommend micromark with micromark-extension-ofm instead.

If you don’t use plugins and want to access the syntax tree, you can use mdast-util-from-markdown with mdast-util-ofm.

Install

This package is ESM only. In Node.js (version 18+), install with npm:

npm install @moritzrs/remark-ofm

Use

import remarkOfm from "@moritzrs/remark-ofm";
import remarkParse from "remark-parse";
import remarkStringify from "remark-stringify";
import { unified } from "unified";

const file = await unified()
	.use(remarkParse)
	.use(remarkOfm)
	.use(remarkStringify)
	.process("> [!info]+ Hey There\n> #tag\n> [[link]]");

console.log(String(file));

Yields

> [!info]+ Hey There
> #tag
> [[link]]

API

This package exports no identifiers. The default export is remarkOfm.

unified.use(remarkOfm)

Add support for OFM (callouts, tags, wikilinks).

Parameters
  • none
Returns

Nothing (undefined).

Compatibility

This package was tested to work with node version 18 and later.

Related

Contribute

I don't know if i can check PRs in a timely manner, but feel free to open PRs or issues. If participation is high I will need to add a code of conduct and contribution guidelines.

Disclaimer

This package is not affiliated with Obsidian.md or the developers of Obsidian.md.

License

MIT © Moritz R. Schulz

Package Sidebar

Install

npm i @moritzrs/remark-ofm

Weekly Downloads

2

Version

0.0.1

License

MIT

Unpacked Size

5.79 kB

Total Files

5

Last publish

Collaborators

  • moritzrs