Every extension
hashtag
A hashtag, as a node rather than styled text.
The same argument as `mention`: an atom cannot be half-deleted into `#mat`, and a document that stores the tag as an attribute can be asked for its tags without anyone parsing prose. Typing `#word` and a space makes one; `#` inside a word — `a#b`, a colour, a URL fragment — is left alone.
Adding it
import { createEditor, document, paragraph, text, hashtag } from '@matrajs/core'
const editor = createEditor({
extensions: [document, paragraph, text, hashtag({ … })],
element: document.querySelector('#editor'),
})
There is no separate package · hashtag is already in @matrajs/core, and an extension you do not import is not in your bundle. document, paragraph and text are the floor every document needs.
Options
| Field | Type | |
|---|---|---|
name | string | Node name, if you need two kinds of tag in one editor. |
render | (tag: string) => string | What appears in the document. Defaults to `#tag`. |
Commands
-
editor.commands.insertHashtag()
Attributes
-
tag
HTML
-
Parses
span[data-hashtag] -
Renders
span