Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pugjs/doc-down
Renders markdown with custom elements inline for documentation
https://github.com/pugjs/doc-down
Last synced: about 2 months ago
JSON representation
Renders markdown with custom elements inline for documentation
- Host: GitHub
- URL: https://github.com/pugjs/doc-down
- Owner: pugjs
- License: mit
- Created: 2016-12-18T21:59:22.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-22T02:40:24.000Z (about 8 years ago)
- Last Synced: 2024-12-11T09:17:55.757Z (about 2 months ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 0
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE.md
Awesome Lists containing this project
README
# doc-down
Renders markdown with custom elements inline for documentation
[![Build Status](https://img.shields.io/travis/pugjs/doc-down/master.svg)](https://travis-ci.org/pugjs/doc-down)
[![Dependency Status](https://img.shields.io/david/pugjs/doc-down/master.svg)](http://david-dm.org/pugjs/doc-down)
[![NPM version](https://img.shields.io/npm/v/doc-down.svg)](https://www.npmjs.org/package/doc-down)## Installation
```
npm install doc-down --save
```## Usage
```md
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:
```js
var DocDown = require('doc-down');const dd = new DocDown();
fs.writeFileSync('data.json', JSON.stringify(dd.parse('some **markdown**')));
```On the client side:
```js
const data = require('./data.json');// you can use any kind of react component here
function MyElementName(props) {
return{props.children};
}
const customElements = {
MyElementName,
};ReactDOM.render(
,
document.body,
)
```## License
MIT