render patchwork/ssb messages to markdown.
patchwork has a few changes from standard markdown.
var md = require('ssb-markdown')
Render raw markdown source
to html.
The output will be html content without a surrounding tag.
Render raw markdown to a single line of test,
suitable for a one line preview that is opened
to a view rendered with block
.
An object containing custom markdown rendering functions. opts
are the
same for both md.block
and md.inline
toUrl
is a function which accepts an ssb-ref or @-mention string, and whether it is for an image or not,
and returns a url string.
imageLink
is a function which accepts an ssb-ref and will be used to generate links to wrap any images.
emoji
is a function which accepts an emoji as markup and
over-rides the default emoji rendering behavior.
const opts = {
toUrl: ref => renderUrlRef(ref),
imageLink: ref => renderImageRef(ref),
emoji: emojiAsMarkup => renderEmoji(emojiAsMarkup)
}
md.block(source, opts)
md.inline(source, opts)
MIT