开源软件名称(OpenSource Name):jmcmanus/pagedown-extra开源软件地址(OpenSource Url):https://github.com/jmcmanus/pagedown-extra开源编程语言(OpenSource Language):JavaScript 95.3%开源软件介绍(OpenSource Introduction):OverviewNote: This project is no longer actively maintained. This is a collection of Pagedown plugins to enable support for
Markdown Extra syntax. Open UsageFirst, make sure you have the most recent version of Pagedown (as of Feb 3, 2013), as it adds more powerful hooks that this implementation relies on. In order to use the extensions, you'll need to include
// create a pagedown converter - regular and sanitized versions are both supported
var converter = new Markdown.Converter();
// tell the converter to use Markdown Extra
Markdown.Extra.init(converter);
// convert some markdown
var html = converter.makeHtml("| A | B |\n| :-: | :-: |\n| 1 | 2 |"); To use this in Node.js with Pagedown: var pagedown = require("pagedown");
var converter = new pagedown.Converter();
var pagedownExtra = require("pagedown-extra");
pagedownExtra.init(converter); If you're using multiple converters on the same page, you can just call
If you want, you can choose to use only a subset of the extensions currently supported: Markdown.Extra.init(converter, {extensions: ["tables", "fenced_code_gfm", "def_list"]}); See the Extension/Option Reference below for a complete list. TablesThe following markdown: | Item | Value | Qty |
| --------- | -----:|:--: |
| Computer | $1600 | 5 |
| Phone | $12 | 12 |
| Pipe | $1 |234 | will render to something like this depending on how you choose to style it:
You can also specify a class for the generated tables using
Span-level markdown inside of table cells will also be converted. Fenced Code BlocksFenced code blocks are supported à la GitHub. This markdown:
Will be transformed into: <pre>
<code>var x = 2;</code>
</pre> You can specify a syntax highlighter in the options object passed to // highlighter can be either `prettify` or `highlight`
Markdown.Extra.init(converter, {highlighter: "prettify"}); If either of those is specified, the language type will be added to the code tag, e.g.
Would generate the following html: <pre class="prettyprint">
<code class="language-javascript">var x = 2;</code>
</pre> Definition ListsTerm 1
: Definition 1
Term 2
: This definition has a code block.
code block
becomes: <dl>
<dt>Term 1</dt>
<dd>
Definition 1
</dd>
<dt>Term 2</dt>
<dd>
This definition has a code block.
<pre><code>code block</code></pre>
</dd>
</dl> Definitions can contain both inline and block-level markdown. FootnotesHere is a footnote[^footnote].
[^footnote]: Here is the *text* of the **footnote**. becomes: <p>Here is a footnote<a href="#fn:footnote" id="fnref:footnote" title="See footnote" class="footnote">1</a>.</p>
<div class="footnotes">
<hr>
<ol>
<li id="fn:footnote">Here is the <em>text</em> of the <strong>footnote</strong>. <a href="#fnref:footnote" title="Return to article" class="reversefootnote">↩</a></li>
</ol>
</div> Special AttributesYou can add class and id attributes to headers and gfm fenced code blocks.
SmartyPantsSmartyPants extension converts ASCII punctuation characters into "smart" typographic punctuation HTML entities. For example:
NewlinesNewlines à la GitHub (without the need of two white spaces): Roses are red
Violets are blue becomes: <p>Roses are red <br>
Violets are blue</p> StrikethroughStrikethrough à la GitHub: ~~Mistaken text.~~ becomes: <p><del>Mistaken text.</del></p> Extension / Option ReferenceYou can enable all of the currently supported extensions with
Italicized extensions are planned, and will be added in roughly the order shown See PHP Markdown Extra's documentation for a more complete overview of syntax. In situations where it differs from how things are done on GitHub -- alignment of table headers, for instance -- I've chosen compatibility with gfm, which seems to be quickly becoming the most widely used markdown implementation. Special CharactersMarkdown Extra adds two new special characters, ##License See LICENSE.txt |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论