lib/parse-markdown.js
function(description) {
  // Look for triple backtick code blocks flagged as `glimmer`;
  // define end of block as triple backticks followed by a newline
  let matches = description.match(/(```glimmer)(.|\n)*?```/gi);

  if (matches && matches.length) {
    matches.map(codeBlock => {
      let blockEnd = codeBlock.length + description.indexOf(codeBlock);
      let plainCode = codeBlock.replace(/(```glimmer|```)/gi, '');
      description = `${description.slice(0, (blockEnd))}${plainCode}${ description.slice(blockEnd)}`;
    });
  }

  return description;
}
function(description) {
  // Look for triple backtick code blocks flagged as `glimmer`;
  // define end of block as triple backticks followed by a newline
  let matches = description.match(/(```glimmer)(.|\n)*?```/gi);

  if (matches && matches.length) {
    matches.map(codeBlock => {
      let blockEnd = codeBlock.length + description.indexOf(codeBlock);
      let plainCode = codeBlock.replace(/(```glimmer|```)/gi, '');
      description = `${description.slice(0, (blockEnd))}${plainCode}${ description.slice(blockEnd)}`;
    });
  }

  return description;
}
function ( description ) { // Look for triple backtick code blocks flagged as `glimmer`; // define end of block as triple backticks followed by a newline let matches = description . match ( / (```glimmer)(.|\n)*?``` / gi ) ; if ( matches && matches . length ) { matches . map ( codeBlock => { let blockEnd = codeBlock . length + description . indexOf ( codeBlock ) ; let plainCode = codeBlock . replace ( / (```glimmer|```) / gi , '' ) ; description = ` ${ description . slice ( 0 , ( blockEnd ) ) } ${ plainCode } ${ description . slice ( blockEnd ) } ` ; } ) ; } return description ; }
Scans the description text for instances of markdown code blocks flagged
as `"glimmer"` syntax. If any such instances are found, they are copied,
stripped of their triple backticks and re-inserted into the
`templateString` immediately after the original declaration. This allows
for functional copies of your code examples to be automatically rendered
into the description, without having to duplicate the code block itself.

If your functional code needs to have different setup to work correctly in
the Fountainhead context (for example, if you need to use `core-state` to
set up sandboxed state and controls), simply use `"handlebars"` or no
syntax flag, and manually add the code block you want Fountainhead to
render after your example. Neato!

@method _renderCodeBlocks
@param {String} description The description text to scan for code blocks
@return {String}
Scans the description text for instances of markdown code blocks flagged as glimmer syntax . If any such instances are found they are copied stripped of their triple backticks and re - inserted into the templateString immediately after the original declaration . This allows for functional copies of your code examples to be automatically rendered into the description without having to duplicate the code block itself .