查看演示頁面以查看標記的實際效果 ⛹️
我們的文件頁面也使用標記的?
另請閱讀:
Node.js:僅支援目前版本和 LTS Node.js 版本。 Node.js 生命週期結束版本可能隨時與 Marked 不相容。
瀏覽器:不是 IE11 :)
命令列介面:
npm install -g marked
瀏覽器內:
npm install marked
DOMPurify.sanitize(marked.parse(`<img src="x" onerror="alert('not happening')">`));
命令列介面
# Example with stdin input
$ marked -o hello.html
hello world
^D
$ cat hello.html
< p > hello world < /p >
# Print all options
$ marked --help
瀏覽器
<!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 the browsernnRendered by **marked**.' ) ;
</ script >
</ body >
</ html >
或導入esm模組
< script type =" module " >
import { marked } from "https://cdn.jsdelivr.net/npm/marked/lib/marked.esm.js" ;
document . getElementById ( 'content' ) . innerHTML =
marked . parse ( '# Marked in the browsernnRendered by **marked**.' ) ;
</ script >
版權所有 (c) 2011-2022,克里斯多福‧傑弗瑞。 (麻省理工學院許可證)