markdown

Useful utilities for working with Markdown.

Source:

Methods

(static) markdownToArray(markdownopt) → {Array.<(string|Object)>}

Source:

Converts an arbitrary Markdown string to an array of plain objects describing React Elements for easy serialization/unserialization.

Example
import {markdownToArray} from 'webcompiler';
// or - import {markdownToArray} from 'webcompiler/lib/markdown';
// or - var markdownToArray = require('webcompiler').markdownToArray;
// or - var markdownToArray = require('webcompiler/lib/markdown').markdownToArray;

markdownToArray('# Hello world!'); // [{type: 'h1', children: ['Hello world!']}]
Parameters:
Name Type Attributes Default Description
markdown string <optional>
""

an arbitrary Markdown string

Returns:

an array of plain objects describing React Elements

Type
Array.<(string|Object)>

(static) markdownToHTML(markdownopt) → {string}

Source:

Converts an arbitrary Markdown string to an HTML string

Example
import {markdownToHTML} from 'webcompiler';
// or - import {markdownToHTML} from 'webcompiler/lib/markdown';
// or - var markdownToHTML = require('webcompiler').markdownToHTML;
// or - var markdownToHTML = require('webcompiler/lib/markdown').markdownToHTML;

markdownToHTML('# Hello world!'); // <h1>Hello world!</h1>
Parameters:
Name Type Attributes Default Description
markdown string <optional>
""

an arbitrary Markdown string

Returns:

an HTML string

Type
string

(static) markdownToJSX(markdownopt) → {Array.<ReactElement>}

Source:

Converts an arbitrary Markdown string to an array of React Elements

Example
import {markdownToJSX} from 'webcompiler';
// or - import {markdownToJSX} from 'webcompiler/lib/markdown';
// or - var markdownToJSX = require('webcompiler').markdownToJSX;
// or - var markdownToJSX = require('webcompiler/lib/markdown').markdownToJSX;

<div>{markdownToJSX('# Hello world!')}</div>
Parameters:
Name Type Attributes Default Description
markdown string <optional>
""

an arbitrary Markdown string

Returns:

an array of React Elements

Type
Array.<ReactElement>