marky-markdown是npm的官方markdown解析器,基于NodeJS编写,旨在用 GitHub-stylemarkdown进行奇偶校验。它由一个最好的 CommonMarkmarkdown解析器——markdown-it构建。
安装
npm install marky-markdown --save编程中使用
marky-markdown输出单独函数。为了基本使用,这个函数使用一个由字符串转换而成的参数。
var marky = require("marky-markdown")marky("# hello, I'm markdown").html()命令行使用
你可以在shell中使用marky-markdown来解析markdown文件,最简单的方法是全局安装它。
npm i -g marky-markdownmarky-markdown some.md > some.html它能做什么
Parsesmarkdownwithmarkdown-it,afastandcommonmark-compliantparser.
Removesbrokenandmalicioususerinputwithsanitize-html
AppliessyntaxhighlightingtoGitHub-flavoredcodeblocksusingthehighlightslibraryfromAtom.
UsescheeriotoperformvariousfeatsofDOMmanipulation.
Converts:emoji:-styleshortcutstounicodeemojis.
Convertsheadings(h1,h2,etc)intoanchoredhyperlinks.
ConvertsrelativeGitHublinkstotheirabsoluteequivalents.
ConvertsrelativeGitHubimagessourcestotheirGitHubrawequivalents.
ConvertsinsecureGravatarURLstoHTTPS.
Convertslistitemswithleading[]and[x]intoGitHub-styletasklists
WrapsembeddedYouTubevideossotheycanbestyled.
Parsesandsanitizespackage.descriptionasmarkdown.
AppliesCSSclassestoredundantcontentthatcloselymatchesnpmpackagenameanddescription.
AppliesCSSclassestobadgeimages,sowecandosomethinginterestingwiththemoneday.
npm包
var package = { name: "foo", description: "foo is a thing", repository: { type: "git", url: "https://github.com/kung/foo" }}marky( "# hello, I am the foo readme", {package: package}).html()
评论