How to use unist-util-remove-position - 5 common examples

To help you get started, we’ve selected a few unist-util-remove-position 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 geut / chan / src / parser / index.js View on Github external
createMDAST(value, forceArray = false) {
            const result = removePosition(remarkInstance.parse(value), true);
            if (result.children.length === 1 && !forceArray) {
                return result.children[0];
            }
            return result.children;
        },
        exists() {
github mosjs / mos / packages / mos-core / src / parse / index.ts View on Github external
const start: Location = {
            line: 1,
            column: 1,
            offset: 0,
          }
          const node: Node = {
            type: 'root',
            children,
            position: {
              start,
              end: parser.eof || Object.assign({}, start),
            },
          }

          if (!parser.options.position) {
            removePosition(node)
          }

          return node
        })
    },
github geut / chan / src / parser / index.js View on Github external
export default function parser(dir = process.cwd()) {
    let _mtree;

    const pathname = path.resolve(dir, 'CHANGELOG.md');
    const contents = read(pathname);
    return {
        remark: remarkInstance,
        gitCompare: null,
        SEPARATORS,
        root: removePosition(remarkInstance.parse(contents), true),
        createMDAST(value, forceArray = false) {
            const result = removePosition(remarkInstance.parse(value), true);
            if (result.children.length === 1 && !forceArray) {
                return result.children[0];
            }
            return result.children;
        },
        exists() {
            return contents !== null;
        },
        write(content = this.stringify()) {
            return write(pathname, content);
        },
        stringify(root = this.root) {
            return remarkInstance.stringify(root, {
                listItemIndent: '1'
github aliyun / alibabacloud-console-components / site / src / buildtime / fetchFusionDocFromGithub / fetchFusionDoc.ts View on Github external
export function parseMarkdown(str: string): mdast.Root {
  const ast = removePosition(parsePipeline.parse(str))
  assertMdAST(ast)
  return ast
}
github elmasse / nextein / src / plugins / markdown / index.js View on Github external
const parse = ({ position, raw, ...options }) => (value) => {
  const { content } = value
  const instance = parser(options)
  const parsed = instance.runSync(instance.parse(content))

  return {
    ...value,
    content: position ? parsed : removePosition(parsed, true),
    raw: raw ? content : undefined
  }
}

unist-util-remove-position

unist utility to remove positions from a tree

MIT
Latest version published 10 months ago

Package Health Score

74 / 100
Full package analysis

Popular unist-util-remove-position functions