2.1.1 • Published 17 days ago

mdast-util-from-adf v2.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
17 days ago

mdast-util-from-adf

Checks npm version

mdast utility to convert ADF.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install mdast-util-from-adf

Use

Say we have the following script, example.js:

import { fromADF } from "mdast-util-from-adf";
import { toMarkdown } from "mdast-util-to-markdown";

const doc = {
  version: 1,
  type: "doc",
  content: [
    {
      type: "paragraph",
      content: [
        {
          type: "text",
          text: "Hello ",
        },
        {
          type: "text",
          text: "ADF",
          marks: [
            {
              type: "link",
              attrs: {
                href: "https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/",
              },
            },
            {
              type: "strong",
            },
          ],
        },
        {
          type: "text",
          text: "!",
        },
      ],
    },
  ],
};

console.log(toMarkdown(fromADF(doc)));

Now, running node example yields:

Hello **[ADF](https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/)**!

References

2.1.1

17 days ago

2.1.0

2 years ago

2.0.0-pre

2 years ago

2.0.0

2 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago