Get heading markdown
@param {string} text Source test
@param {number} size size
@returns {string}
974170
function getHeadingMarkdown(text, size) {
  const foundedHeading = text.match(FIND_HEADING_RX);
  let heading = '';

  do {
    heading += '#';
    size -= 1;
  } while (size > 0);

  if (foundedHeading) {
    [, text] = text.split(foundedHeading[0]);
  }

  return `${heading} ${text}`;
}
1257912
private static String getSize(IResponsiveLabel r, Sizes size) {
		String colSize = "-1";
		switch(size) {
		case xs:
			colSize = r.getLabelColXs();
			if(colSize.equals("-1")) colSize = r.getLabelTinyScreen();
			break;
		case sm:
			colSize = r.getLabelColSm();
			if(colSize.equals("-1")) colSize = r.getLabelSmallScreen();
			break;
		case md:
			colSize = r.getLabelColMd();
			if(colSize.equals("-1")) colSize = r.getLabelMediumScreen();
			break;
		case lg:
			colSize = r.getLabelColLg();
			if(colSize.equals("-1")) colSize = r.getLabelLargeScreen();
			break;
		}
		return colSize;
	}
314647
function (markdownString) {
                    var nonGreedyAllMatcherMultiLine = '(.|\r|\n)*?';
                    var matchIgnoredEmoji = new RegExp(
                        '<!--\\s*ignore:advanced-emoji:start\\s*-->' +
                        nonGreedyAllMatcherMultiLine +
                        '<!--\\s*ignore:advanced-emoji:end\\s*-->',
                        'g');
                    return markdownString.replace(matchIgnoredEmoji, function (match) {
                        namedEmoji.forEach(function(emojiCode) {
                            match = match.replace(new RegExp(':' + emojiCode + ':', 'g'), '::ignore-' + emojiCode.replace(/:/g, '') + '-ignore::');
                        });
                        return match;
                    });
                }
743298
function findPagesMarkdown(
  directory = path.resolve(__dirname, '../../../src/pages'),
  pagesMarkdown = [],
) {
  const items = fs.readdirSync(directory);

  items.forEach(item => {
    const itemPath = path.resolve(directory, item);

    if (fs.statSync(itemPath).isDirectory()) {
      findPagesMarkdown(itemPath, pagesMarkdown);
      return;
    }

    if (!markdownRegex.test(item)) {
      return;
    }

    let pathname = itemPath
      .replace(new RegExp(`\\${path.sep}`, 'g'), '/')
      .replace(/^.*\/pages/, '')
      .replace('.md', '');

    // Remove the last pathname segment.
    pathname = pathname
      .split('/')
      .slice(0, 3)
      .join('/');

    pagesMarkdown.push({
      // Relative location in the path (URL) system.
      pathname,
      // Relative location in the file system.
      filename: itemPath,
    });
  });

  return pagesMarkdown;
}
396175
function (string) {
    return (
      string
        // Escape backslash escapes!
        .replace(/\\(\S)/g, '\\\\$1')

        // Escape headings
        .replace(/^(#{1,6} )/gm, '\\$1')

        // Escape hr
        .replace(/^([-*_] *){3,}$/gm, function (match, character) {
          return match.split(character).join('\\' + character)
        })

        // Escape ol bullet points
        .replace(/^(\W* {0,3})(\d+)\. /gm, '$1$2\\. ')

        // Escape ul bullet points
        .replace(/^([^\\\w]*)[*+-] /gm, function (match) {
          return match.replace(/([*+-])/g, '\\$1')
        })

        // Escape blockquote indents
        .replace(/^(\W* {0,3})> /gm, '$1\\> ')

        // Escape em/strong *
        .replace(/\*+(?![*\s\W]).+?\*+/g, function (match) {
          return match.replace(/\*/g, '\\*')
        })

        // Escape em/strong _
        .replace(/_+(?![_\s\W]).+?_+/g, function (match) {
          return match.replace(/_/g, '\\_')
        })

        // Escape code _
        .replace(/`+(?![`\s\W]).+?`+/g, function (match) {
          return match.replace(/`/g, '\\`')
        })

        // Escape link brackets
        .replace(/[\[\]]/g, '\\{{{toMarkdown}}}') // eslint-disable-line no-useless-escape
    )
  }
186590
function sourceString(source) {
  var message = "<css input>"
  if (source) {
    if (source.input && source.input.file) {
      message = source.input.file
    }
    if (source.start) {
      message += ":" + source.start.line + ":" + source.start.column
    }
  }

  return message
}
102993
function getDocObject(dir, info) {
  const markdown = getReadmeText(dir);
  const html = marked(markdown);
  const cleanedHTML = prepareHTML(html, info);
  return { pkg: dir, html: cleanedHTML };
}
110446
function markdown_table (headers, table) {
	// FIXME: Implement better markdown table formating
	return ARRAY([headers, [ "---", "---" ]]).concat(table).map(cols => '| ' + ARRAY(cols).join(' | ') + ' |').join('\n');
}
1061576
@CheckForNull
    @Deprecated
    public String getIconFilePath(String size) {
        if (!StringUtils.isBlank(getIconFilePathPattern())) {
            return getIconFilePathPattern().replace(":size", size);
        }
        return null;
    }
394888
function md2html( file ){
  file = file.substr( file.length - 3 ) === '.md' ? file : file + '.md'; // add extension if need be

  let md;
  try{
    md = fs.readFileSync( path.join(__dirname, './md', file) , 'utf8');
  } catch(e){
    throw 'A markdown file named `' + file + '` was referenced but could not be read';
  }

  // let html = converter.makeHtml( md );
  //let html = mdConvertor( md );
  let html = marked( md, {
    highlight: function(code, lang){
      let ret;

      if( lang ){
        ret = hljs.highlight(lang, code).value;
      } else {
        ret = hljs.highlightAuto(code).value;
      }

      return ret;

    },

    smartypants: true,

    renderer: mdRend,

    gfm: true
  } );


  return html;
}
1331463
function (md) {
            var html = marked(md, this.options.markdown);
            //Only reprocess if helpers were asked for
            if (this.options.helpers || (html.indexOf('{{#crossLink') > -1)) {
                //console.log('MD: ', html);
                try {
                    // marked auto-escapes quotation marks (and unfortunately
                    // does not expose the escaping function)
                    html = html.replace(/&quot;/g, "\"");
                    html = (Y.Handlebars.compile(html))({});
                } catch (hError) {
                    //Remove all the extra escapes
                    html = html.replace(/\\{/g, '{').replace(/\\}/g, '}');
                    Y.log('Failed to parse Handlebars, probably an unknown helper, skipping..', 'warn', 'builder');
                }
                //console.log('HB: ', html);
            }
            return html;
        }
803575
function Markdown(data = '', options = {}) {

    this.initData = data;
    this.renderTree = null;
    this.html = '';

    this.fullInfo = !!options.fullInfo;
    this.dialect = options.dialect || Markdown.Dialect.DEFAULT;

}
1360995
function getPandocId (text) {
  text = text
    .replace(emojiRegex(), '') // Strip emojis
    .toLowerCase()
    .trim()
    .replace(/%25|%/ig, '')   // remove single % signs
    .replace(RE_ENTITIES, '') // remove xml/html entities
    .replace(RE_SPECIALS, '') // single chars that are removed but not [.-]
    .replace(/\s+/g, '-')     // whitespaces
    .replace(/^-+|-+$/g, '')  // heading/ tailing hyphen
    .replace(RE_CJK, '')      // CJK punctuations that are removed

  if (/^[0-9-]+$/.test(text)) {
    text = 'section'
  }
  return text
}
243717
function parse(size) {
  var matches = size.match(regexp);

  if (!matches)
    return null;

  var multiplicator = matches[3] ? +matches[3].replace(/x$/, '') : 1;

  return {
    width: +matches[1] * multiplicator,
    height: +matches[2] * multiplicator
  };
}
188898
private static String getHeaderTemplate(int[] widths, String[] headers) {
        return IntStream.range(0, widths.length).mapToObj(i -> {
            final int width = widths[i];
            final int length = headers[i].length();
            final int leading = (width - length) / 2;
            final int trailing = width - (length + leading);
            final StringBuilder text = new StringBuilder();
            whitespace(text, leading + 1);
            text.append("%").append(i + 1).append("$s");
            whitespace(text, trailing);
            text.append("  |");
            return text.toString();
        }).reduce((left, right) -> left + " " + right).orElse("");
    }
217425
function Guide({ match, data }) {
  const {
    params: { mod, header: headerParam, environment }
  } = match;
  const doc = data.guides.find(doc => mod === doc.title.slug);
  const header =
    doc && headerParam ? doc.headers.find(h => h.slug === headerParam) : null;
  return !doc ? (
    <Redirect to={`/${environment}`} />
  ) : (
    <Block className="api-doc-wrapper" fontSize="80%">
      <Block className="api-doc">
        <ScrollToDoc doc={doc} header={header} />
        <MarkdownViewer html={doc.markup} />
      </Block>
      <Route
        path={`${match.path}/:header`}
        render={({
          match: {
            params: { header: slug }
          }
        }) => {
          const header = doc.headers.find(h => h.slug === slug);
          return header ? (
            <ScrollToDoc doc={doc} header={header} />
          ) : (
            <Redirect to={`/${environment}/guides/${mod}`} />
          );
        }}
      />
    </Block>
  );
}
343789
function parseStyleText( styleText )
	{
		var retval = {};
		styleText
		   .replace( /&quot;/g, '"' )
		   .replace( /\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g, function( match, name, value )
		{
			retval[ name ] = value;
		} );
		return retval;
	}