How to use the remark-parse.Parser function in remark-parse

To help you get started, we’ve selected a few remark-parse examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github umijs / father-doc / packages / umi-plugin-father-doc / src / transformer / remark / parse.ts View on Github external
return tokenizer;
}

// decorate for all block tokenizers
Object.keys(blockTokenizers).forEach(method => {
  blockTokenizers[method] = tokenizerDecorator(blockTokenizers[method]);
});

// decorate for all inline tokenizers
Object.keys(inlineTokenizers).forEach(method => {
  inlineTokenizers[method] = tokenizerDecorator(inlineTokenizers[method]);
});

// proxy set options to avoid remove the custom strategy option
(parse.Parser.prototype as any).setOptions = function(opts) {
  if (this.options.strategy) {
    opts.strategy = this.options.strategy;
  }
  setOptions.call(this, opts);
};

export default parse as Plugin<[Partial?]>;
github umijs / father-doc / packages / umi-plugin-father-doc / src / transformer / remark / parse.ts View on Github external
import parse, { RemarkParseOptions } from 'remark-parse';
import { Plugin } from 'unified';

export interface IParseProps extends RemarkParseOptions {
  /**
   * transform strategy
   * @note  turn on all markdown tokenizers by default
   *        only turn on tokenizers which use for parse yaml data if pass 'data'
   */
  strategy: 'default' | 'data';
}

const { blockTokenizers, inlineTokenizers, setOptions } = parse.Parser.prototype as any;
const oFencedCode = blockTokenizers.fencedCode;
const DISABLEABLE_TOKENIZERS = [
  'indentedCode',
  'fencedCode',
  'blockquote',
  'thematicBreak',
  'list',
  'setextHeading',
  'html',
  'footnote',
  'definition',
  'table',
  'escape',
  'autoLink',
  'url',
  'html',
github Siteimprove / alfa / packages / markdown / src / parse.ts View on Github external
export function parse(markdown: string): Root {
  const parser = new Parser(null, vfile(markdown));
  const parsed = parser.parse();

  clean(parsed);

  return parsed;
}

remark-parse

remark plugin to add support for parsing markdown input

MIT
Latest version published 1 year ago

Package Health Score

79 / 100
Full package analysis