Back to list
mcclowes

commonmark

by mcclowes

OAS Markdown Grammar is a human-first domain-specific language for API specification

1🍴 0📅 Jan 12, 2026

SKILL.md


name: commonmark

prettier-ignore

description: Use when parsing or generating Markdown following the CommonMark specification - AST structure, block/inline elements, and extensions

CommonMark Markdown

Quick Start

import { Parser, HtmlRenderer } from 'commonmark';

const parser = new Parser();
const renderer = new HtmlRenderer();

const ast = parser.parse('# Hello\n\nWorld');
const html = renderer.render(ast);

AST Node Types

Block Elements

TypeDescription
documentRoot node
heading# through ######
paragraphText block
code_blockFenced (```) or indented
block_quote> prefixed
listOrdered or bullet list
itemList item
thematic_break---, ***, ___

Inline Elements

TypeDescription
textPlain text
emph*italic* or _italic_
strong**bold** or __bold__
code`inline`
link[text](url)
image![alt](src)
softbreakLine break in source
hardbreakTwo spaces + newline

Walking the AST

const walker = ast.walker();
let event;
while ((event = walker.next())) {
  const { node, entering } = event;
  if (node.type === 'heading' && entering) {
    console.log(`H${node.level}: ${node.firstChild?.literal}`);
  }
}

Key Parsing Rules

  • Blank line separates paragraphs
  • 4-space indent = code block (unless in list)
  • Fenced code: 3+ backticks, optional info string
  • Setext headings: === or --- underline
  • Links: [text](url "title") or [text][ref]

Extensions (GFM)

GitHub Flavored Markdown adds:

  • Tables: | col | col |
  • Strikethrough: ~~text~~
  • Task lists: - [ ] and - [x]
  • Autolinks: URLs become links automatically

Tips

  • Use node.literal for text content
  • Use node.destination for link/image URLs
  • node.info contains fenced code language
  • Modify AST before rendering for transformations

Score

Total Score

65/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon