• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

mikeal/markdown-element: HTML Element that renders markdown content.

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

mikeal/markdown-element

开源软件地址(OpenSource Url):

https://github.com/mikeal/markdown-element

开源编程语言(OpenSource Language):

JavaScript 86.6%

开源软件介绍(OpenSource Introduction):

Markdown Element

HTML Element for markdown content.

Usage:

<body>
  <script src="https://cdn.jsdelivr.net/npm/markdown-element/dist/markdown-element.min.js"></script>
  <mark-down>
    ## h2

    * test
      * test2

    ```javascript
    let x = 'asdf'

    class Text {
      constructor() {

      }
    }
    ```
  </mark-down>
</body>

Attributes/properties

The following element properties can be used to change the render settings. They can be set either from JavaScript or from HTML.

  • noGFM: Disables GitHub flavored markdown (GFM).
  • noTables: Disables GFM tables. This has no effect if noGFM is true.
  • breaks: Enable GFM line breaks. This has no effect if noGFM is true.
  • noHighlight: Disables syntax highlighting.
  • pedantic: Conform to obscure parts of markdown.pl as much as possible. Don't fix any of the original markdown bugs or poor behavior.
  • noSmartLists: Disable smarter list behavior than the original markdown. May eventually be default with the old behavior moved into pedantic.
  • smartyPants: Use "smart" typographic punctuation for things like quotes and dashes.

Examples:

<mark-down notables pedantic>
    # h1

    * test
</mark-down>
let marked = document.createElement('mark-down')
marked.noGFM = true
marked.smartyPants = true
document.body.appendChild(marked)

Rendering

The rendered markdown is placed in a <render> element.

<mark-down>
  <render>
    <h1>h1</h1>
    <ul>
      <li>test</li>
    </ul>
  </render>
</mark-down>

Bundling

If you want to build the component into the JavaScript bundle of your app you can do so easily, but you'll need to handle loading a WebComponents polyfill on your own.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap