Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/moritzrs/mdast-util-ofm-tag

mdast extensions to support Obsidian Flavored Markdown (OFM) tags
https://github.com/moritzrs/mdast-util-ofm-tag

markdown mdast mdast-util obsidian

Last synced: 27 days ago
JSON representation

mdast extensions to support Obsidian Flavored Markdown (OFM) tags

Awesome Lists containing this project

README

        

# mdast-util-ofm-tag

[mdast](https://github.com/syntax-tree/mdast) extensions to support Obsidian Flavored Markdown (OFM) [tags](https://help.obsidian.md/Editing+and+formatting/Tags).

## Contents

- From Markdown Extension
- To Markdown Extension

## Installation

This package is **ESM only**, install latest version with `npm`:

```bash
npm install https://github.com/moritzrs/mdast-util-ofm-tag
```

## Usage

```javascript
import { fromMarkdown } from "mdast-util-from-markdown";
import { toMarkdown } from "mdast-util-to-markdown";
import { ofmTag } from "micromark-extension-ofm-tag";
import { ofmTagFromMarkdown, ofmTagToMarkdown } from "mdast-util-ofm-tag";

const markdown = "This is a #tag.";

const tree = fromMarkdown(markdown, {
extensions: [ofmTag()],
mdastExtensions: [ofmTagFromMarkdown()],
});

const result = toMarkdown(tree, {
extensions: [ofmTagToMarkdown()],
});

console.log(result); // "This is a #tag."
```

## Related

- [micromark-extension-ofm-tag](https://github.com/moritzrs/micromark-extension-ofm-tag) - micromark extension to parse OFM tags.

## Disclaimer

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

## License

[MIT](LICENSE.md) © Moritz R. Schulz