markdown前端渲染

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown前端渲染相关的知识,希望对你有一定的参考价值。

参考技术A https://www.jianshu.com/p/b932f305b1ec

使用 CDN 加载 js 文件:

marked([markdown内容]) 可以将 Markdown 源码转换为 html

示例:

css 将Markdown渲染为未渲染的Markdown(请参阅http://jsbin.com/huwosomawo)

* {
    font-size: 12pt;
    font-family: monospace;
    font-weight: normal;
    font-style: normal;
    text-decoration: none;
    color: black;
    cursor: default;
}

h1::before { content: "# "; }
h2::before { content: "## "; }
h3::before { content: "### "; }
h4::before { content: "#### "; }
h5::before { content: "##### "; }
h6::before { content: "###### "; }
strike::after, strike::before { content: "~~"; }
i::before, i::after { content: "*"; }
b::before, b::after { content: "**"; }
ol, ul { list-style: none; padding-left: 0; }
ul li::before { content: "* "; }
ol li::before { content: "1. "; }
code::before, code::after { content: "`"; }
pre::before { content: "```" attr(lang) "\A"; }
pre::after { content:"```\A"; }
a::before { content: "["; }
a::after { content: "](" attr(href) ")"; }
tr::before { content: "| "; }
td::after { content: " | "; }
thead td::after { content: " | \A-----| "; white-space: pre; }

以上是关于markdown前端渲染的主要内容,如果未能解决你的问题,请参考以下文章

html可以直接内嵌markdown文件吗

使用Chrome浏览器作为Markdown渲染器--最优雅的Markdown预览方案

如何像 VuePress 一样渲染 Markdown?

css 将Markdown渲染为未渲染的Markdown(请参阅http://jsbin.com/huwosomawo)

css 将Markdown渲染为未渲染的Markdown(请参阅http://jsbin.com/huwosomawo)

css 将Markdown渲染为未渲染的Markdown(请参阅http://jsbin.com/huwosomawo)