How to use the marked function in marked

To help you get started, we’ve selected a few 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 influxdata / clockface / src / Components / IndexList / Documentation / IndexList.stories.tsx View on Github external
`Header clicked! nextSort: ${nextSort}, sortKey: ${sortKey}`
                  )
                }
              />
            
          
        
        <div>
          <button>Log Ref</button>
        </div>
      
    )
  },
  {
    readme: {
      content: marked(IndexListHeaderCellReadme),
    },
  }
)

indexListStories.add(
  'IndexListBody',
  () =&gt; {
    const indexListBodyRef = createRef()

    const logRef = (): void =&gt; {
      /* eslint-disable */
      console.log(indexListBodyRef.current)
      /* eslint-enable */
    }

    return (
github tylercrosse / gitter-clone / src / server / controllers / messages.js View on Github external
export const addMessage = (io, action) => {
  const rawMarkup = marked(action.text);
  const doc = {
    username: action.username,
    text: action.text,
    rawMarkup,
    convo: action.convo
  };

  Convo.findOne({name: action.convo})
    .then(/* istanbul ignore next */(convo) => (_createMessage(doc, convo)))
    .then(_saveConvo)
    .then(/* istanbul ignore next */(result) => (_emitAddMessage(io, result)))
    .catch(/* istanbul ignore next */(err) => {
      logger.log('error', err);
    });
};
github dittos / diffmonster / src / ui / CommentThread.tsx View on Github external
function renderMarkdown(body: string): string {
  const rendered = marked(body, { gfm: true, sanitize: true });
  return rendered.replace(/&lt;(\/?sub)&gt;/g, '&lt;$1&gt;'); // TODO: is it okay?
}
github tjscollins / axe-crawler / src / output.js View on Github external
list += `<br>${escape(message)}`;
    });
    none.forEach(({ message }) =&gt; {
      list += `<br>${escape(message)}`;
    });
    list += '';
    return list;
  /* eslint-enable no-param-reassign */
  }

  try {
    body += `${marked(`## Detailed List of Failing Tests: ${
      Object.entries(reports).reduce((total, [url, report]) =&gt; total + countResults(report, 'violations'), 0)} total failing tests`)}`;
  } catch (err) {
    logger.error('Error counting failed tests: ', err);
    body += marked('## Detailed List of Failing Tests');
  }
  body += '<div class="row"><div class="col-xs-12">';

  function listTestResults([view, results]) {
    /* eslint-disable no-param-reassign */
    if (results.length &gt; 0) {
      const list = `<h4>${view.toUpperCase()}</h4><br><ol>${results.reduce((item, {
        description,
        nodes,
        impact,
      }) =&gt; {
        item += `<li>${impact ? `${impact.toUpperCase()}: ` : ''}${escape(description)}<br>`;
        item += '<span>Affected Nodes: </span><ul>';
        item += nodes.reduce(writeNodeMessages, '');
        item += '</ul></li>';
        return item;</ol></div></div>
github mlaursen / react-md / docs / src / shared / components / Markdown / Markdown.jsx View on Github external
componentWillReceiveProps(nextProps) {
    if (this.props.markdown !== nextProps.markdown) {
      this.setState({ markdown: marked(nextProps.markdown) });
    }
  }
github gershonv / react-blog / src / examples / markdown / write.jsx View on Github external
function translateMarkdown(plainText) {
  return marked(plainText, {
    renderer: new marked.Renderer(),
    gfm: true,
    pedantic: false,
    sanitize: false,
    tables: true,
    breaks: true,
    smartLists: true,
    smartypants: true,
    highlight: function(code) {
      return hljs.highlightAuto(code).value
    }
  })
}
github Juliiii / React-Cnode / src / store / publish.js View on Github external
@computed get markdown () {
    return marked(this.content);
  }
github dittos / diffmonster / src / ui / Summary.js View on Github external
export default function Summary({ pullRequest }) {
  return (
    
  );
}
github CodeForPhilly / philly-ward-leaders / src / views / content-page.vue View on Github external
content: (state) => {
      if (state.contentPage.content) {
        return marked(state.contentPage.content)
      }
    }
  }),