1.0.3 • Published 4 years ago

unified-doc-parse-text v1.0.3

Weekly downloads
13
License
MIT
Repository
github
Last release
4 years ago

unified-doc-parse-text

unified-doc parser to parse text content into a hast tree with a single text node.

Install

npm install unified-doc-parse-text

Use

import text from "unified-doc-parse-text";
import unified from "unified";

const processor = unified().use(text);
const content = "\na to the \nb to the \n\nc to the d";

expect(processor.parse(content)).toEqual({
  type: 'root',
  children: [
    {
      type: 'text',
      value: '\na to the \nb to the \n\nc to the d',
      position: {
        start: {
          column: 1,
          line: 1,
          offset: 0,
        },
        end: {
          column: 20,
          line: 1,
          offset: 19,
        },
      },
    },
  ],
  position: {
    start: {
      column: 1,
      line: 1,
      offset: 0,
    },
    end: {
      column: 20,
      line: 1,
      offset: 19,
    },
  },
});

API

function parse(): void;

Use the parser with any unified processor.

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.1.6-beta.0

4 years ago

0.1.5-beta.0

4 years ago

0.1.4-beta.0

4 years ago

0.1.3-beta.0

4 years ago

0.1.2-beta.0

4 years ago

0.1.1-beta.0

4 years ago

0.1.0-beta.0

4 years ago