How to use the remarkable.Remarkable function in remarkable

To help you get started, we’ve selected a few remarkable 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 rcarmo / azure-durable-functions-node-blog-engine / renderMarkdownActivity / index.js View on Github external
/*
 * This function is not intended to be invoked directly. Instead it will be
 * triggered by an orchestrator function.
 */

const storage = require("azure-storage"),
      matter = require("gray-matter"),
      remarkable = require('remarkable'),
      hljs = require('highlight.js'),
      blobService = storage.createBlobService(process.env['AzureWebJobsStorage']);

var md = new remarkable.Remarkable({
    highlight: function (str, lang) {
      if (lang && hljs.getLanguage(lang)) {
        try {
          return hljs.highlight(lang, str).value;
        } catch (err) {}
      }
  
      try {
        return hljs.highlightAuto(str).value;
      } catch (err) {}
  
      return ''; // use external default escaping
    },
    typographer: true,
    html: true
});
github coderplanets / coderplanets_web / src / containers / CheatsheetThread / Cheatsheet.js View on Github external
// eslint-disable-next-line import/named
import { COMMUNITY_CHEATSHEET } from '@config'

import { uid } from '@utils'
import {
  Wrapper,
  CardWrapper,
  ErrorWrapper,
  ErrorTitle,
  ErrorLink,
} from './styles/cheatsheet'
import parser from './parser'
import CheatSheetStyle from './styles/CheatsheetMarkStyles'

const md = new Remarkable()

const Cards = ({ cards }) =>
  cards.map(item => (
    
      
        <div>
      
    
  ))

const Cheatsheet = ({ source, communityRaw }) =&gt; {</div>
github webtorrent / webtorrent.io / server / index.js View on Github external
const highlight = require('highlight.js')
const http = require('http')
const morgan = require('morgan')
const path = require('path')
const pug = require('pug')
const { Remarkable } = require('remarkable')

const config = require('../config')
const desktopApi = require('./desktop-api')

const PORT = Number(process.argv[2]) || 4000

const app = express()
const server = http.createServer(app)

const remark = new Remarkable({
  html: true,
  highlight: function (code, lang) {
    const h = lang
      ? highlight.highlight(lang, code)
      : highlight.highlightAuto(code)
    return '<div class="hljs">' + h.value + '</div>'
  }
})

pug.filters.markdown = (md, options) =&gt; {
  return remark.render(md)
}

// Trust "X-Forwarded-For" and "X-Forwarded-Proto" nginx headers
app.enable('trust proxy')
github coderplanets / coderplanets_web / src / components / MarkDownRender / index.js View on Github external
import { Remarkable } from 'remarkable'
import emojiPlugin from 'remarkable-emoji'
import mentionsPlugin from 'remarkable-mentions'
import Prism from 'mastani-codehighlight'

import { MENTION_USER_ADDR } from '@config'
import { buildLog } from '@utils'

import MarkDownStyle from '@containers/ThemeWrapper/MarkDownStyle'
import { PreviewerContainer } from './styles'

/* eslint-disable-next-line */
const log = buildLog('c:MarkDownRender:index')

// const md = new Remarkable()
const md = new Remarkable('full', {
  // NOTE:  html should always be false
  // Enable HTML tags in source
  html: false,
  breaks: false,
  linkTarget: '_blank',
})

md.use(mentionsPlugin({ url: MENTION_USER_ADDR }))
md.use(emojiPlugin)

class MarkDownRender extends React.Component {
  constructor(props) {
    super(props)

    this.state = { body: '' }
  }
github ory / kratos / docs / scripts / gen-faq.js View on Github external
id: faq
title: Frequently Asked Questions (FAQ)
---




import {Question, FaqTags} from '@theme/Faq'


<br><br>

`
md = new Remarkable()
faq.forEach((el) =&gt; {
  markdownPage += `\n`
  markdownPage += `${el.tags
    .map((tag) =&gt; {
      return '#' + tag
    })
    .join(' ')}
`
  markdownPage += md.render(`**Q**: ${el.q}`)
  markdownPage += md.render(`**A**: ${el.a}`)
  if (el.context) {
    markdownPage += md.render(`context: ${el.context}`)
  }
  markdownPage += `

<br>
github alanshaw / markdown-pdf / index.js View on Github external
function flush (cb) {
      var self = this

      var mdParser = new Remarkable(opts.remarkable.preset, extend({
        highlight: function (str, lang) {
          if (lang && hljs.getLanguage(lang)) {
            try {
              return hljs.highlight(lang, str).value
            } catch (err) {}
          }

          try {
            return hljs.highlightAuto(str).value
          } catch (err) {}

          return ''
        }
      }, opts.remarkable))

      opts.remarkable.plugins.forEach(function (plugin) {
github plotly / dash-table / src / dash-table / components / Tooltip / index.tsx View on Github external
constructor(props: ITooltipProps) {
        super(props);

        this.state = {
            md: new Remarkable()
        };
    }
github cockpit-project / cockpit / pkg / packagekit / updates.jsx View on Github external
constructor() {
        super();
        this.state = { expanded: false };
        this.remarkable = new Remarkable();
    }

remarkable

Markdown parser, done right. 100% Commonmark support, extensions, syntax plugins, high speed - all in one.

MIT
Latest version published 4 years ago

Package Health Score

77 / 100
Full package analysis