1.0.1 • Published 6 months ago

marklassian v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

Marklassian

A lightweight JavaScript library that transforms Markdown to the Atlassian Document Format (ADF). Built for easy integration with Atlassian products and APIs.

Visit our interactive playground to experiment with Markdown to ADF conversion in real-time.

npm version license

Features

  • Convert Markdown to ADF with a single function call
  • Support for the most common Markdown syntax
  • TypeScript-ready with full type definitions
  • Works in all modern JavaScript environments (Browsers, Node.js, Deno, Bun)

Installation

npm install marklassian

Usage

import { markdownToAdf } from 'marklassian';

const markdown = '# Hello World';
const adf = markdownToAdf(markdown);

Supported Markdown Features

  • Headings (H1-H6)
  • Paragraphs and line breaks
  • Emphasis (bold, italic, strikethrough)
  • Links and images
  • Code blocks with language support
  • Ordered and unordered lists with nesting
  • Blockquotes
  • Horizontal rules
  • Tables

API Reference

markdownToAdf(markdown: string): AdfDocument

Converts a Markdown string to an ADF document object (JSON serialisable).

Types

type AdfNode = {
    type: string;
    attrs?: Record<string, any>;
    content?: AdfNode[];
    marks?: AdfMark[];
    text?: string;
};

type AdfMark = {
    type: string;
    attrs?: Record<string, any>;
};

type AdfDocument = {
    version: 1;
    type: 'doc';
    content: AdfNode[];
};

References

For those interested in the ADF format, the following resources may be helpful:

License

MIT

1.0.1

6 months ago

1.0.0

6 months ago