@@ -98,7 +98,9 @@ Use triple backticks with an optional language identifier:
9898 end
9999 ```
100100
101- Supported language for syntax highlighting: ` ruby ` , ` rb ` (alias to ` ruby ` ), and ` c ` .
101+ Supported languages for syntax highlighting: ` ruby ` (and ` rb ` alias) with server-side
102+ highlighting, and ` c ` , ` bash ` /` sh ` /` shell ` /` console ` with client-side JavaScript highlighting.
103+ Other info strings are accepted and added as a CSS class but receive no highlighting.
102104
103105### Blockquotes
104106
@@ -420,6 +422,9 @@ For example:
420422* [ Link to Blockquotes] ( #blockquotes )
421423* [ Link to Anchor Links] ( #anchor-links )
422424
425+ When multiple headings produce the same anchor, RDoc appends ` -1 ` , ` -2 ` , etc.
426+ to subsequent duplicates, matching GitHub's behavior.
427+
423428## Footnotes
424429
425430### Reference Footnotes
@@ -535,7 +540,7 @@ See [rdoc.rdoc](rdoc.rdoc) for complete directive documentation.
535540| Headings | ` = Heading ` | ` # Heading ` |
536541| Bold | ` *word* ` | ` **word** ` |
537542| Italic | ` _word_ ` | ` *word* ` |
538- | Monospace | ` +word+ ` | `` `word` `` |
543+ | Monospace | ` +word+ ` or `` `word` `` | `` `word` `` |
539544| Links | ` {text}[url] ` | ` [text](url) ` |
540545| Code blocks | Indent beyond margin | Indent 4 spaces or fence |
541546| Block quotes | ` >>> ` | ` > ` |
@@ -551,8 +556,104 @@ See [rdoc.rdoc](rdoc.rdoc) for complete directive documentation.
551556
5525573 . ** Footnotes are collapsed** - Multiple paragraphs in a footnote become a single paragraph.
553558
554- 4 . ** Syntax highlighting** - Only ` ruby ` and ` c ` are supported for fenced code blocks .
559+ 4 . ** Syntax highlighting** - Only ` ruby ` / ` rb ` (server-side) and ` c ` , ` bash ` / ` sh ` / ` shell ` / ` console ` (client-side) receive syntax highlighting. Other info strings are accepted but not highlighted .
555560
5565615 . ** Fenced code blocks** - Only triple backticks are supported. Tilde fences (` ~~~ ` ) are not supported as they conflict with strikethrough syntax. Four or more backticks for nesting are also not supported.
557562
5585636 . ** Auto-linking** - RDoc automatically links class and method names in output, even without explicit link syntax.
564+
565+ ## Comparison with GitHub Flavored Markdown (GFM)
566+
567+ This section compares RDoc's Markdown implementation with the
568+ [ GitHub Flavored Markdown Spec] ( https://github.github.com/gfm/ ) (Version 0.29-gfm, 2019-04-06).
569+
570+ ### Block Elements
571+
572+ | Feature | GFM | RDoc | Notes |
573+ | ---------| :---:| :----:| -------|
574+ | ATX Headings (` # ` ) | ✅ | ✅ | Both support levels 1-6, optional closing ` # ` |
575+ | Setext Headings | ✅ | ✅ | ` = ` for H1, ` - ` for H2 |
576+ | Paragraphs | ✅ | ✅ | Full match |
577+ | Indented Code Blocks | ✅ | ✅ | 4 spaces or 1 tab |
578+ | Fenced Code (backticks) | ✅ 3+ | ⚠️ 3 only | RDoc doesn't support 4+ backticks for nesting |
579+ | Fenced Code (tildes) | ✅ ` ~~~ ` | ❌ | Conflicts with strikethrough syntax |
580+ | Info strings (language) | ✅ any | ⚠️ limited | ` ruby ` /` rb ` , ` c ` , and ` bash ` /` sh ` /` shell ` /` console ` highlighted; others accepted as CSS class |
581+ | Blockquotes | ✅ | ✅ | Full match, nested supported |
582+ | Lazy Continuation | ✅ | ⚠️ | Continuation text is included in blockquote but line break is lost (becomes a space) |
583+ | Bullet Lists | ✅ | ✅ | ` * ` , ` + ` , ` - ` supported |
584+ | Ordered Lists | ✅ ` . ` ` ) ` | ⚠️ ` . ` only | RDoc doesn't support ` ) ` delimiter; numbers are always renumbered from 1 |
585+ | Nested Lists | ✅ | ✅ | 4-space indentation |
586+ | Tables | ✅ | ✅ | Full alignment support |
587+ | Thematic Breaks | ✅ | ✅ | ` --- ` , ` *** ` , ` ___ ` |
588+ | HTML Blocks | ✅ 7 types | ⚠️ | See below |
589+
590+ #### HTML Blocks
591+
592+ GFM defines 7 types of HTML blocks:
593+
594+ | Type | Description | GFM | RDoc | Notes |
595+ | ------| -------------| :---:| :----:| -------|
596+ | 1 | ` <script> ` , ` <pre> ` | ✅ | ✅ | |
597+ | 1 | ` <style> ` | ✅ | ❌ | Available via ` css ` extension (disabled by default) |
598+ | 2 | HTML comments ` <!-- --> ` | ✅ | ✅ | |
599+ | 3 | Processing instructions ` <? ?> ` | ✅ | ❌ | |
600+ | 4 | Declarations ` <!DOCTYPE> ` | ✅ | ❌ | |
601+ | 5 | CDATA ` <![CDATA[ ]]> ` | ✅ | ❌ | |
602+ | 6 | Block-level tags | ✅ | ⚠️ | |
603+ | 7 | Any complete open/close tag | ✅ | ❌ | |
604+
605+ RDoc uses a whitelist of block-level tags defined in
606+ [ lib/rdoc/markdown.kpeg] ( https://github.com/ruby/rdoc/blob/master/lib/rdoc/markdown.kpeg )
607+ (see ` HtmlBlockInTags ` ). HTML5 semantic elements like ` <article> ` , ` <section> ` ,
608+ ` <nav> ` , ` <header> ` , ` <footer> ` are not supported.
609+
610+ ### Inline Elements
611+
612+ | Feature | GFM | RDoc | Notes |
613+ | ---------| :---:| :----:| -------|
614+ | Emphasis ` *text* ` ` _text_ ` | ✅ | ⚠️ | Intraword emphasis not supported (see [ Notes] ( #notes-and-limitations ) ) |
615+ | Strong ` **text** ` ` __text__ ` | ✅ | ✅ | Full match |
616+ | Combined ` ***text*** ` | ✅ | ✅ | Full match |
617+ | Code spans | ✅ | ✅ | Multiple backticks supported |
618+ | Inline links | ✅ | ✅ | Full match |
619+ | Reference links | ✅ | ✅ | Full match |
620+ | Link titles | ✅ | ⚠️ | Parsed but not rendered |
621+ | Images | ✅ | ✅ | Full match |
622+ | Autolinks ` <url> ` | ✅ | ✅ | Full match |
623+ | Hard line breaks | ✅ | ⚠️ | 2+ trailing spaces only; backslash ` \ ` at EOL not supported |
624+ | Backslash escapes | ✅ | ⚠️ | Subset of GFM's escapable characters (e.g., ` ~ ` not escapable) |
625+ | HTML entities | ✅ | ✅ | Named, decimal, hex |
626+ | Inline HTML | ✅ | ⚠️ | ` <b> ` converted to ` <strong> ` , ` <i> ` to ` <em> ` ; ` <strong> ` itself is escaped |
627+
628+ ### GFM Extensions
629+
630+ | Feature | GFM | RDoc | Notes |
631+ | ---------| :---:| :----:| -------|
632+ | Strikethrough ` ~~text~~ ` | ✅ | ✅ | Full match |
633+ | Task Lists ` [ ] ` ` [x] ` | ✅ | ❌ | Not supported |
634+ | Extended Autolinks | ✅ | ⚠️ | See below |
635+ | Disallowed Raw HTML | ✅ | ❌ | No security filtering |
636+
637+ #### GFM Extended Autolinks
638+
639+ GFM automatically converts certain text patterns into links without requiring
640+ angle brackets (` <> ` ). RDoc also auto-links URLs and ` www. ` prefixes through
641+ its cross-reference system, but the behavior differs from GFM.
642+
643+ GFM recognizes these patterns:
644+
645+ - ` www.example.com ` — text starting with ` www. ` followed by a valid domain
646+ - ` https://example.com ` — URLs starting with ` http:// ` or ` https:// `
647+ - ` user@example.com ` — valid email addresses
648+
649+ RDoc auto-links ` www. ` prefixes and ` http:// ` /` https:// ` URLs similarly to GFM.
650+ However, bare email addresses like ` user@example.com ` are not auto-linked;
651+ use ` <user@example.com> ` instead.
652+
653+ ### RDoc-Specific Features (not in GFM)
654+
655+ - [ Definition Lists] ( #definition-lists )
656+ - [ Footnotes] ( #footnotes )
657+ - [ Cross-references] ( #cross-references )
658+ - [ Anchor Links] ( #anchor-links )
659+ - [ Directives] ( #directives )
0 commit comments