How to use safe-marked - 1 common examples

To help you get started, we’ve selected a few safe-marked 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 cypress-io / cypress-fiddle / src / index.js View on Github external
/// 
// @ts-check

const { createMarkdown } = require('safe-marked')
const markdown = createMarkdown()

Cypress.Commands.add('runExample', options => {
  const { name, description, html, test } = options
  const testTitle = name || cy.state('runnable').title

  if (typeof test !== 'string' || !test) {
    expect(test, 'must have test source').to.be.a('string')
  }

  // really dummy way to see if the test code contains "cy.visit(...)"
  // because in that case we should not use "cy.within" or mount html
  const isTestingExternalSite = test.includes('cy.visit(')
  if (!isTestingExternalSite) {
    const htmlSection = html
      ? `<h2>HTML</h2>
    <div id="html"></div>

safe-marked

Markdown to HTML using marked and DOMPurify. Safe by default.

MIT
Latest version published 10 months ago

Package Health Score

61 / 100
Full package analysis

Popular safe-marked functions