@golden-tiger/markdown
v0.0.25
Published
Transform markdown to HTML
Downloads
10
Readme
#golden-tiger/markdown
Transform markdown text to html element.
How to use
import { transform } from '@golden-tiger/markdown'; // mjs
const { transform } = require('@golden-tiger/markdown'); // cjs
transform('# Title\n- Content');
transform
function has 2 parameters:- param 1
mdText
: To transformed markdown text content. - param 2
transformOptions
: Options of output.output
:options
ordom
.options
means return value oftransform
function will be an object, which describes the HTML structure of themdText
.dom
means return value oftransform
function will be a DOM object, which can be inserted to HTML directly.indent
: A number, which is the pixel value of indent.
- param 1
The basic syntax of
mdText
is same as normal markdown, such as # indicates a header, > indicates a quota, and so on.Basic tables are made by separating each cell with the pipe | symbol, and can be enhanced further with additional options to create advanced table layouts. This online markdown editor supports rowspan and colspan markdown table. Use |(-m)...| to create a m column span table cell <td colspan="m">. Use |(=n)...| to create a n row span table cell <td rowspan="n">.
// Example:
|(=2)align center|align left|align right|
|a|b|
|:-:|:--|--:|
|c|d|e|
|(-2)f|g|
|h|(-2)(=3)i|
|j|
|k|