<commit_before>const Promise = require('bluebird')

module.exports = function note (hexo, args, content) {
  // {% note info Want to see Cypress in action? %}
  // Explore talks, blogs, and podcasts about testing in Cypress.
  // {% endnote %}
  //
  // <<< Transforms into >>>
  //
  // <blockquote class="note info">
  //   <strong class="note-title">Want to see Cypress in action?</strong>
  //   <p>
  //     Explore talks, blogs, and podcasts about testing in Cypress.
  //   </p>
  // </blockquote>

  const iconLookup = {
    info: 'info-circle',
    warning: 'exclamation-circle',
    success: 'check-circle',
    danger: 'times-circle',
    bolt: 'bolt', // useful for tips / hints
  }

  let header = ''
  const className = args.shift()
  const icon = iconLookup[className]

  if (args.length) {
    header += `<strong class="note-title foo">
      ${icon ? `<i class="fa fa-${icon}"></i>` : ''}
      ${args.join(' ')}
    </strong>`
  }

  return Promise.resolve(
    hexo.render.renderSync({ text: content, engine: 'markdown' })
  ).then((markdown) => {
    return `<blockquote class="note ${className}">${header}${markdown}</blockquote>`<commit_msg>Add support for notes with Markdown in the header (#881)<commit_after>const Promise = require('bluebird')

module.exports = function note (hexo, args, content) {
  // {% note info Want to see Cypress in action? %}
  // Explore talks, blogs, and podcasts about testing in Cypress.
  // {% endnote %}
  //
  // <<< Transforms into >>>
  //
  // <blockquote class="note info">
  //   <strong class="note-title">Want to see Cypress in action?</strong>
  //   <p>
  //     Explore talks, blogs, and podcasts about testing in Cypress.
  //   </p>
  // </blockquote>

  const iconLookup = {
    info: 'info-circle',
    warning: 'exclamation-circle',
    success: 'check-circle',
    danger: 'times-circle',
    bolt: 'bolt', // useful for tips / hints
  }

  const toMarkdown = (text) =>
    hexo.render.renderSync({ text, engine: 'markdown' })

  const stripSurroundingParagraph = (text) =>
    text.replace(/^<p>/, '').replace(/<\/p>$/, '')

  let header = ''
  const className = args.shift()
  const icon = iconLookup[className]

  if (args.length) {
    header += `<strong class="note-title foo">
      ${icon ? `<i class="fa fa-${icon}"></i>` : ''}
      ${stripSurroundingParagraph(toMarkdown(args.join(' ')))}
    </strong>`
  }

  return Promise.resolve(
    toMarkdown(content)
  ).then((markdown) => {
    return `<blockquote class="note ${className}">${header}${markdown}</blockquote>`
{'fraction_non_alphanumeric': 0.1809635722679201, 'fraction_numerical': 0.0011750881316098707, 'mean_word_length': 3.0475435816164818, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2307821', 'n_tokens_mistral': 855, 'n_tokens_neox': 811, 'n_words': 214}