Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/moritzrs/micromark-extension-ofm-tag

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

markdown micromark micromark-extension obsidian

Last synced: 27 days ago
JSON representation

micromark extensions to support Obsidian Flavored Markdown (OFM) tags

Awesome Lists containing this project

README

        

# micromark-extension-ofm-tag

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

## Contents

- Syntax Extension
- HTML Extension

## Installation

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

```bash
npm install https://github.com/moritzrs/micromark-extension-ofm-tag
```

## Usage

```javascript
import { micromark } from "micromark";
import { ofmTag, ofmTagHtml } from "micromark-extension-ofm-tag";

const output = micromark("This is a #tag.", {
extensions: [ofmTag()],
htmlExtensions: [ofmTagHtml()],
});

console.log(output);
```

Yields:

```html

This is a tag.


```

## Syntax States

```mermaid
flowchart TD

start["Start"]
ok["Ok"]
nok["Nok"]

inside_tag_candidate["Inside Tag Candidate"]
inside_tag["Inside Tag"]

start --> |PREVIOUS_IS_CHARACTER| nok
start --> |NUMBER_SIGN| inside_tag_candidate
start --> |ELSE| nok

inside_tag_candidate --> |NUMBER| inside_tag_candidate
inside_tag_candidate --> |WORD| inside_tag
inside_tag_candidate --> |ELSE| nok

inside_tag --> |WORD_OR_NUMBER| inside_tag
inside_tag --> |ELSE| ok
```

## Related

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

## Disclaimer

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

## License

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