doc-down

0.0.2 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i doc-down

Weekly Downloads

1

Version

0.0.2

License

MIT

Last publish

Collaborators

  • forbeslindesay