Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Sage-Bionetworks/markdown-it-synapse

Repository files navigation

This repo has been archived since it has been moved into the synapse-web-monorepo

markdown-it-synapse

Build Status NPM version Coverage Status

Synapse tag plugin for markdown-it markdown parser.

v1.+ requires markdown-it v4.+, see changelog.

${image?fileName=joy%2Epng&align=None} => <span id="widget-0my-unique-div-id" class="widgetContainer" widgetparams="image?fileName=joy%2Epng&amp;align=None" />

Install

node.js, browser:

npm install markdown-it-synapse --save
bower install markdown-it-synapse --save

Use

var md = require('markdown-it')()
            .use(require('markdown-it-synapse'));

md.render('${image?fileName=joy%2Epng&align=None}', 'my-unique-div-id') // => '<span id="widget-0my-unique-div-id" class="widgetContainer" widgetparams="image?fileName=joy%2Epng&amp;align=None" />'

The widgetparams can be used to determine what kind of html widget should be rendered in the output container.

Differences in browser. If you load script directly into the page, without package system, module will add itself globally as window.markdownitSynapse.

License

MIT