0.0.2 • Published 7 years ago

doc-down v0.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

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