Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/moritzrs/micromark-extension-ofm-tag
- Owner: MoritzRS
- License: mit
- Created: 2024-10-16T17:40:23.000Z (29 days ago)
- Default Branch: main
- Last Pushed: 2024-10-16T17:40:25.000Z (29 days ago)
- Last Synced: 2024-10-18T12:56:07.229Z (28 days ago)
- Topics: markdown, micromark, micromark-extension, obsidian
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
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 TDstart["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| nokinside_tag_candidate --> |NUMBER| inside_tag_candidate
inside_tag_candidate --> |WORD| inside_tag
inside_tag_candidate --> |ELSE| nokinside_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