How to use the markdown-it.disable function in markdown-it

To help you get started, we’ve selected a few markdown-it examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ChrisZou / geekweibo / app / javascript / src / common / Utils.js View on Github external
const md = require('markdown-it')({
  html:         false,        // Enable HTML tags in source
  breaks:       true,        // Convert '\n' in paragraphs into <br>
  // langPrefix:   'language-',  // CSS language prefix for fenced blocks. Can be useful for external highlighters.
  linkify:      true,        // Autoconvert URL-like text to links
}).disable(['image', 'hr', 'table', 'list', 'heading', 'lheading', 'blockquote', 'reference', 'html_block', 'html_inline'])

const markdown = (text) =&gt; md.render(text)

const scaledAvatar = (avatar, nickname, timestamps) =&gt; {
  if (!timestamps) timestamps = 0
  if (avatar) {
    if (timestamps) {
      return `${avatar}?x-oss-process=image/resize,m_fill,h_100,w_100&amp;s=${timestamps}`
    } else {
      return `${avatar}?x-oss-process=image/resize,m_fill,h_100,w_100`
    }