
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@orbiting/remark-preset
Advanced tools
Preconfigured remark for our projects.
parseimport { parse } from '@orbiting/remark-preset'
parse(md): Mdast
md: String
The markdown to parse.
Returns a mdast tree.
stringifyimport { stringify } from '@orbiting/remark-preset'
stringify(mdast): String
md: String
The mdast tree to stringify.
Returns a markdown string.
zone<section><h6>IDENTIFIER</h6>
Group arbitrary markdown
<hr /></section>
Yields following AST:
{
type: 'zone',
identfier: 'IDENTIFIER',
children: [{type: 'paragraph', children: [
{type: 'text', value: 'Group arbitrary markdown'}
]}]
}
Zones can be nested and can have data (stringified as json in a code node). Under the hood the zone type is expanded and collapsed into flat nodes wrapped by html nodes with the section markup.
sub and sup Types# CO<sub>2</sub>
40 µg/m<sup>3</sup>
Yields following AST:
[
{
type: 'heading',
depth: 1,
children: [
{type: 'text', value: 'CO'},
{
type: 'sub',
children: [
{type: 'text', value: '2'}
]
}
]
},
{
type: 'paragraph',
children: [
{type: 'text', value: '40 µg/m'},
{
type: 'sup',
children: [
{type: 'text', value: '3'}
]
}
]
}
]
span TypeNeed custom inline nodes? Use span.
<span data-number="10000">10'000</span>
Yields following AST:
{
type: 'paragraph',
children: [
{
type: 'span',
data: {
number: '10000'
},
children: [
{
type: 'text',
value: '10\'000'
}
]
}
]
}
node.data must be a flat object with only strings. Each key gets mapped to its own data attribute. You can store complex data, if you really need to, by using one key with stringified json.
Yaml meta data on root.meta. Powered by js-yaml and remark-frontmatter.
If want only want the features and configure the unified processors yourself, you can import them individually:
import unified from 'unified'
import remarkStringify from 'remark-stringify'
import remarkParse from 'remark-parse'
import frontmatter from 'remark-frontmatter'
import * as meta from '@orbiting/remark-preset/lib/meta'
import * as zone from '@orbiting/remark-preset/lib/zone'
import * as tag from '@orbiting/remark-preset/lib/tag'
import * as span from '@orbiting/remark-preset/lib/span'
unified()
.use(remarkParse, {
// your options
})
.use(frontmatter, ['yaml'])
.use(meta.parse)
.use(zone.collapse({
test: ({type, value}) => {
// your logic
},
mutate: (start, nodes, end) => {
// your logic
return {
type: 'zone',
children: nodes
}
}
}))
.use(span.collapse)
.use(tag.collapse('sub'))
const stringifier = unified()
.use(remarkStringify, {
// your options
})
.use(frontmatter, ['yaml'])
.use(meta.format)
.use(zone.expand({
test: ({type}) => type === 'zone',
mutate: (node) => {
// your logic
return [
{
type: 'html',
value: `<section>`
},
...node.children,
{
type: 'html',
value: '</section>'
}
]
}
}))
.use(span.expand)
.use(tag.expand('sub'))
FAQs
a preconfigured mdast processor with zones and meta data
The npm package @orbiting/remark-preset receives a total of 59 weekly downloads. As such, @orbiting/remark-preset popularity was classified as not popular.
We found that @orbiting/remark-preset demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.