🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@create-markdown/core

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@create-markdown/core

Block-based markdown parsing and serialization with zero dependencies

latest
Source
npmnpm
Version
2.0.3
Version published
Maintainers
1
Created
Source

@create-markdown/core

Block-based markdown parsing and serialization with zero dependencies.

Installation

# Using pnpm
pnpm add @create-markdown/core

# Using npm
npm install @create-markdown/core

# Using yarn
yarn add @create-markdown/core

# Using pnpm
pnpm add @create-markdown/core

Quick Start

Parse Markdown to Blocks

import { parse } from '@create-markdown/core';

const blocks = parse(`# Hello World

This is **bold** and *italic* text.

- Item one
- Item two
`);

Create Blocks Programmatically

import { h1, paragraph, bulletList, bold, italic, spans } from '@create-markdown/core';

const blocks = [
  h1('My Document'),
  paragraph(spans(
    bold('Important: '),
    { text: 'This is ', styles: {} },
    italic('really'),
    { text: ' cool!', styles: {} }
  )),
  bulletList(['First item', 'Second item', 'Third item']),
];

Serialize Blocks to Markdown

import { stringify, h1, paragraph, codeBlock } from '@create-markdown/core';

const markdown = stringify([
  h1('Hello'),
  paragraph('World'),
  codeBlock('console.log("Hi!");', 'javascript'),
]);

Block Types

TypeFactory FunctionDescription
paragraphparagraph(content)Text paragraph
headingheading(level, content) or h1-h6Heading levels 1-6
bulletListbulletList(items)Unordered list
numberedListnumberedList(items)Ordered list
checkListcheckList(items)Task list with checkboxes
codeBlockcodeBlock(code, language?)Fenced code block
blockquoteblockquote(content)Block quote
imageimage(url, alt?)Image
dividerdivider()Horizontal rule
tabletable(headers, rows)Table with headers
calloutcallout(type, content)Callout/admonition

API Reference

Parsing

  • parse(markdown) - Parse markdown string to blocks
  • markdownToBlocks(markdown, options?) - Full parser with options
  • markdownToDocument(markdown) - Parse to a Document object

Serialization

  • stringify(blocks) - Serialize blocks to markdown
  • blocksToMarkdown(blocks, options?) - Full serializer with options
  • documentToMarkdown(doc) - Serialize a Document

Document Operations

  • createDocument(blocks?, options?) - Create a new document
  • insertBlock(doc, block, index?) - Insert block at position
  • appendBlock(doc, block) - Add block at end
  • removeBlock(doc, blockId) - Remove block by ID
  • updateBlock(doc, blockId, updates) - Update block properties
  • moveBlock(doc, blockId, newIndex) - Reorder blocks
  • findBlock(doc, blockId) - Find block by ID

License

MIT

Keywords

markdown

FAQs

Package last updated on 09 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts