remark-burger 🍔
A remark plugin that extracts text sandwiched between 2 customizable markers & turns it into a node. A transformer or stringify function can then do whatever with the new node type.
yarn add remark-burgernpm install remark-burger
const burger = //// { type: 'patty',// value: '',// data: { content: 'world' },// position: {// start: { line: 1, column: 7, offset: 6 },// end: { line: 1, column: 14, offset: 13 },// indent: [] } }
Options
beginMarker & endMarker
The default pair is [[
& ]]
.
If the marker pair conflicts with markdown default syntax, it won't work. For example, this won't work:
It is because by default, remark-burger
's tokenizer priority is very low so it won't be conflicted with markdown syntax. This can be configured with insertBefore
options.
pattyName
The default name is patty
, but it can be configured to be whatever.
onlyRunWithMarker
This plugin won't run if no marker is declared. Default: false
. The example below won't work:
// doesn't work
insertBefore
Change the order in which the parser will call this plugin's tokenizer. Here's the order list:
escape
autoLink
url
html
link
reference
strong
emphasis
deletion
code
break
<- remark-burger ->
text
By default, remark-burger
's tokenizer is run before text
. You can change this by passing in one of the method listed above. For example, this works: