npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

github-markdown-adf

v1.3.0

Published

Bidirectional GitHub Flavored Markdown (GFM) to/from Atlassian Document Format (ADF) converter for Node.js, browsers, and TypeScript.

Downloads

127

Readme

github-markdown-adf

npm version CI Socket Badge License: Unlicense

Bidirectional GitHub Flavored Markdown (GFM) to / from Atlassian Document Format (ADF) converter.

AI Notice

This package has predominantly AI-generated code. Keep this in mind in case you have a strict policy against using ai-generated code in your project.

Install

npm install github-markdown-adf
# or
pnpm add github-markdown-adf
# or
yarn add github-markdown-adf

Usage

Markdown → ADF

import { mdToAdf } from 'github-markdown-adf';

const markdown = `
# Hello World

This is **bold** and _italic_ text.

- Item 1
- Item 2
`;

const adf = mdToAdf(markdown);
// adf is a fully typed AdfDoc object
console.log(JSON.stringify(adf, null, 2));

ADF → Markdown

import { adfToMd } from 'github-markdown-adf';

const adf = {
  version: 1,
  type: 'doc',
  content: [
    {
      type: 'paragraph',
      content: [{ type: 'text', text: 'Paragraph Text' }]
    }
  ]
};

const markdown = adfToMd(adf);

CDN / Browser (no bundler)

A self-contained browser bundle with all dependencies inlined is available via CDN:

IIFE (<script> tag)

<script src="https://cdn.jsdelivr.net/npm/github-markdown-adf/dist/browser/index.iife.js"></script>
<script>
  const adf = GithubMarkdownAdf.mdToAdf('# Hello World');
  const md  = GithubMarkdownAdf.adfToMd(adf);
</script>

ESM (<script type="module">)

<script type="module">
  import { mdToAdf, adfToMd } from 'https://cdn.jsdelivr.net/npm/github-markdown-adf/dist/browser/index.js';

  const adf = mdToAdf('# Hello World');
</script>

Supported Features

Markdown → ADF

| Feature | Syntax | |---|---| | Headings | # H1 through ###### H6 | | Paragraphs | Plain text blocks | | Bold | **bold** | | Italic | _italic_ | | Strikethrough | ~~strike~~ | | Inline code | `code` | | Underline | <u>text</u> | | Subscript / Superscript | <sub>x</sub> / <sup>2</sup> | | Links | [text](url "title") | | Images | ![alt](url) | | Blockquotes | > text | | Horizontal rules | --- | | Bullet lists | - item | | Ordered lists | 1. item | | Nested lists | Indented list items | | Task lists | - [ ] todo / - [x] done | | Code blocks | ```lang fenced blocks | | Tables | GFM pipe tables | | Mentions | Plain @username text → ADF mention nodes when mdToAdf mentions option is enabled | | GitHub Alerts | > [!NOTE], > [!WARNING], > [!TIP], > [!IMPORTANT], > [!CAUTION] → ADF Panels | | Expandable sections | <details><summary>…</summary>…</details> → ADF Expand nodes |

ADF → Markdown

| ADF Node / Mark | Output | |---|---| | Text marks | bold, italic, strike, underline, code, links, color, background | | Panels (info, note, warning, success, error, tip) | GitHub-style > [!NOTE] alerts | | Expand / NestedExpand | <details><summary>…</summary>…</details> | | Tables | GFM pipe tables | | Bullet / ordered lists | - item / 1. item | | Task lists | - [ ] / - [x] | | Decision lists | - [ ] / - [x] | | Mentions | @accountId | | Emojis | Unicode emoji character | | Hard breaks | \ trailing newline | | Media (single, group, inline) | Markdown image links | | Block cards / embed cards / inline cards | Markdown links | | Date | ISO date string | | Status | Inline text | | Layout sections | Rendered content (layout structure flattened) |

API

import { mdToAdf, adfToMd } from 'github-markdown-adf';

mdToAdf(markdown: string): AdfDoc

Converts a GFM string to an ADF document object. Parses using mdast and micromark GFM extensions, with support for tables, task lists, strikethrough, and GitHub Alert syntax (> [!NOTE], > [!WARNING], etc.).

mdToAdf(markdown: string, options?: MdToAdfOptions): AdfDoc

Converts a GFM string to an ADF document object, with optional parsing controls such as custom mention mapping.

adfToMd(adf: AdfDoc, options?: AdfToMdOptions): string

Converts an ADF document object to a GFM string. Handles all standard ADF node and mark types and produces clean, readable output targeting GitHub Flavored Markdown.

Options

mdToAdf and adfToMd accept an optional second argument to control mention handling and rendering behaviour.

MdToAdfOptions

| Option | Type | Default | Description | |---|---|---|---| | mentions | boolean \| ((username: string) => MentionNode['attrs'] \| null \| undefined) | false | When omitted or false, plain @username text stays unchanged. When true, plain @alice text becomes { type: 'mention', attrs: { id: 'alice', text: '@alice' } }. When a function is provided, it receives the username without the @ prefix and should return mention attrs. Returning null or undefined leaves the original markdown text unchanged. |

AdfToMdOptions

| Option | Type | Default | Description | |---|---|---|---| | mentions | boolean \| ((attrs: MentionNode['attrs']) => string) | true | When true, renders mention nodes as the display text if available, otherwise as @{id}. When false, renders as plain text: display text if available, otherwise just the bare {id} without an @ prefix. When a function is provided, it receives the mention attrs and its return value is used as-is. |

Usage example

// Convert plain @mentions into ADF mention nodes
const adfDoc = mdToAdf('Assigned to @some-user', {
  mentions: (username) => ({
    id: 'jira-account-id',
    text: username === 'some-user' ? '@Some User' : `@${username}`,
  }),
});

// Render mentions as plain text instead of @-tagged references
const md = adfToMd(adfDoc, { mentions: false });

// Render mentions with a custom formatter
const mdWithCustomMentions = adfToMd(adfDoc, {
  mentions: (attrs) => `[@${attrs.text ?? attrs.id}](https://example.com/users/${attrs.id})`,
});

TypeScript Types

All ADF types and option interfaces are exported for use in your own code:

import type { AdfDoc, AdfNode, AdfMark, AdfInlineNode, AdfTopLevelBlockNode } from 'github-markdown-adf';
// Also available: ParagraphNode, HeadingNode, TableNode, PanelNode, CodeBlockNode,
// BulletListNode, OrderedListNode, TaskListNode, TextNode, MentionNode, ...and more

import type { AdfToMdOptions, MdToAdfOptions } from 'github-markdown-adf';

Requirements

  • Node.js ≥ 22, or any modern browser (Chrome 92+, Firefox 95+, Safari 15.2+)

License

Unlicense — public domain. No restrictions.