src/main/multiparser.js/textToDoc
function textToDoc(text, partialNextOptions, parentOptions) {
  const nextOptions = normalize(
    Object.assign({}, parentOptions, partialNextOptions, {
      parentParser: parentOptions.parser,
      originalText: text
    }),
    { passThrough: true, inferParser: false }
  );

  const result = require("./parser").parse(text, nextOptions);
  const ast = result.ast;
  text = result.text;

  const astComments = ast.comments;
  delete ast.comments;
  comments.attach(astComments, ast, text, nextOptions);
  return require("./ast-to-doc")(ast, nextOptions);
}