npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

doc-down

0.0.2

@forbeslindesay

npmHomeRepoSnykSocket
Downloads:11
$ npm install doc-down
DailyWeeklyMonthlyYearly

doc-down

Renders markdown with custom elements inline for documentation

Build Status Dependency Status NPM version

Installation

npm install doc-down --save

Usage

Some **markdown**

This is a custom element where the content is treated as markdown:

: MyElementName(attribute="value")
  This content **must** be indented to appear inside the element.

This is a custom element where the content is treated as plain text:

: MyElementName(attribute="value").
  This is plain text.

This is an element without any content

: MyElementName(attribute="value")

On the server side/in advance if possible:

var DocDown = require('doc-down');

const dd = new DocDown();

fs.writeFileSync('data.json', JSON.stringify(dd.parse('some **markdown**')));

On the client side:

const data = require('./data.json');

// you can use any kind of react component here
function MyElementName(props) {
  return <div>{props.children}</div>;
}
const customElements = {
  MyElementName,
};

ReactDOM.render(
  <Page data={data} customElements={customElements}/>,
  document.body,
)

License

MIT