1.0.6 • Published 8 years ago

markdown-it-synapse-table v1.0.6

Weekly downloads
184
License
MIT
Repository
github
Last release
8 years ago

markdown-it-synapse-table

Build Status NPM version Coverage Status

Synapse markdown table plugin for markdown-it markdown parser that supports Synapse md table syntax. Table headers are optional, and it supports a syntax to specify table css class names.

v1.+ requires markdown-it v5.+, see changelog.

Header 1 | Header 2 | Header 3
--- | --- | ---
Row 1 Content Cell 1  |  Row 1 Content Cell 2  |  Row 1 Content Cell 3
Row 2 Content Cell 1  |  Row 2 Content Cell 2  |  Row 2 Content Cell 3

=>

<table>
	<thead>
		<tr>
			<th>Header 1</th>
			<th>Header 2</th>
			<th>Header 3</th>
		</tr>
	</thead>
<tbody>
	<tr>
		<td>Row 1 Content Cell 1</td>
		<td>Row 1 Content Cell 2</td>
		<td>Row 1 Content Cell 3</td>
	</tr>
	<tr>
		<td>Row 2 Content Cell 1</td>
		<td>Row 2 Content Cell 2</td>
		<td>Row 2 Content Cell 3</td>
	</tr>
</tbody>
</table>

{| class="border text-align-center"
Row 1 Content Cell 1 | Row 1 Content Cell 2  | Row 1 Content Cell 3
Row 2 Content Cell 1 | Row 2 Content Cell 2  | Row 2 Content Cell 3
|}

=>

<table class=" border text-align-center">
	<tbody>
		<tr>
			<td>Row 1 Content Cell 1</td>
			<td>Row 1 Content Cell 2</td>
			<td>Row 1 Content Cell 3</td>
			</tr>
		<tr>
			<td>Row 2 Content Cell 1</td>
			<td>Row 2 Content Cell 2</td>
			<td>Row 2 Content Cell 3</td>
		</tr>
	</tbody>
</table>

Install

node.js, browser:

npm install markdown-it-synapse-table --save
bower install markdown-it-synapse-table --save

Use

var md = require('markdown-it')()
            .use(require('markdown-it-synapse-table'));

md.render('table markdown')

Differences in browser. If you load script directly into the page, without package system, module will add itself globally as window.markdownitSynapseTable.

License

MIT