lib/format/markdown.js
function markdownToSnapshot(content) {
  const tree = mdParser.parse(content);

  const state = {
    name: null,
    suite: null,
    suiteStack: [],
    currentSuite: null,
    currentSnapshotList: null,
    depth: 0
  };

  const children = tree.children;
  for (let i = 0; i < children.length; i++) {
    const c = children[i];
    switch (c.type) {
      case 'heading':
        if (c.depth === 1) {
          enterRootSuite(state, c);
        } else if (c.depth === 2) {
          tryExit(state, suiteDepth(c));
          enterSuite(state, c);
        } else if (c.depth === 4) {
          enterSnapshot(state, c);
        }
        break;
      case 'code':
        pushSnapshotCode(state, c);
        break;
    }
  }

  return { name: state.name, suite: state.suite };
}
function markdownToSnapshot(content) {
  const tree = mdParser.parse(content);

  const state = {
    name: null,
    suite: null,
    suiteStack: [],
    currentSuite: null,
    currentSnapshotList: null,
    depth: 0
  };

  const children = tree.children;
  for (let i = 0; i < children.length; i++) {
    const c = children[i];
    switch (c.type) {
      case 'heading':
        if (c.depth === 1) {
          enterRootSuite(state, c);
        } else if (c.depth === 2) {
          tryExit(state, suiteDepth(c));
          enterSuite(state, c);
        } else if (c.depth === 4) {
          enterSnapshot(state, c);
        }
        break;
      case 'code':
        pushSnapshotCode(state, c);
        break;
    }
  }

  return { name: state.name, suite: state.suite };
}
function markdownToSnapshot ( content ) { const tree = mdParser . parse ( content ) ; const state = { name : null , suite : null , suiteStack : [ ] , currentSuite : null , currentSnapshotList : null , depth : 0 } ; const children = tree . children ; for ( let i = 0 ; i < children . length ; i ++ ) { const c = children [ i ] ; switch ( c . type ) { case 'heading' : if ( c . depth === 1 ) { enterRootSuite ( state , c ) ; } else if ( c . depth === 2 ) { tryExit ( state , suiteDepth ( c ) ) ; enterSuite ( state , c ) ; } else if ( c . depth === 4 ) { enterSnapshot ( state , c ) ; } break ; case 'code' : pushSnapshotCode ( state , c ) ; break ; } } return { name : state . name , suite : state . suite } ; }
markdownToSnapshot converts snapshot from markdown format into native.

@param {string} content Snapshot in a markdown format.
@returns Snapshot in a native format.
markdownToSnapshot converts snapshot from markdown format into native .