logo

Marked Documentation

Marked is

  1. built for speed.专为速度而建。*
  2. a low-level markdown compiler for parsing markdown without caching or blocking for long periods of time.一种低级标记编译器,用于解析标记而无需长时间缓存或阻塞。**
  3. light-weight while implementing all markdown features from the supported flavors & specifications.重量轻,同时实现受支持的flavors&;规格。***
  4. available as a command line interface (CLI) and running in client- or server-side JavaScript projects.作为命令行界面(CLI)提供,并在客户端或服务器端JavaScript项目中运行。

* Still working on metrics for comparative analysis and definition.仍在为比较分析和定义制定指标。
** As few dependencies as possible.尽可能少的依赖项。
*** Strict compliance could result in slower processing when running comparative benchmarking.在运行比较基准测试时,严格的法规遵从性可能会导致处理速度变慢。

Demo演示

Checkout the demo page to see marked in action请查看演示页面以查看标记的操作 ⛹️

These documentation pages are also rendered using marked这些文档页也使用标记的 💯

Installation安装

CLI: npm install -g marked

In-browser: npm install marked

Usage用法

CLI

# Example with stdin input
$ marked -o hello.html
hello world
^D
$ cat hello.html
<p>hello world</p>
# Example with string input
$ marked -s "*hello world*"
<p><em>hello world</em></p>
# Example with file input

echo "**bold text example**" > readme.md

$ marked -i readme.md -o readme.html
$ cat readme.html
<p><strong>bold text example</strong></p>
# Print all options
$ marked --help

Browser浏览器

<!doctype html>
<html>
<head>
  <meta charset="utf-8"/>
  <title>Marked in the browser</title>
</head>
<body>
  <div id="content"></div>
  <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
  <script>
    document.getElementById('content').innerHTML =
      marked.parse('# Marked in browser\n\nRendered by **marked**.');
  </script>
</body>
</html>

Node.js

import { marked } from 'marked';
// or const { marked } = require('marked');

const html = marked.parse('# Marked in Node.js\n\nRendered by **marked**.');

Marked offers advanced configurations and extensibility as well.Marked还提供了高级配置可扩展性

Supported Markdown specifications支持的Markdown规范

We actively support the features of the following Markdown flavors.我们积极支持以下Markdown佐料的功能。

Flavor Version Status
The original markdown.pl --
CommonMark 0.30 Work in progress
GitHub Flavored Markdown 0.29 Work in progress

By supporting the above Markdown flavors, it's possible that Marked can help you use other flavors as well; however, these are not actively supported by the community.通过支持上述Markdown佐料,Marked也可以帮助您使用其他佐料;然而,这些都没有得到社会的积极支持。

Security安全

The only completely secure system is the one that doesn't exist in the first place. 唯一完全安全的系统是一个根本不存在的系统。Having said that, we take the security of Marked very seriously.话虽如此,我们还是非常认真地对待Marked的安全。

Therefore, please disclose potential security issues by email to the project committers as well as the listed owners within NPM. 因此,请通过电子邮件向项目提交人以及NPM内的列出所有人披露潜在的安全问题。We will provide an initial assessment of security reports within 48 hours and should apply patches within 2 weeks (also, feel free to contribute a fix for the issue).我们将在48小时内提供安全报告的初步评估,并应在2周内应用修补程序(另外,请随时提供问题的修复)。