Skip to content

Commit 60aec01

Browse files
committed
Add support for GFM in markdown of JSDoc
Examples: `csstype` has a bunch of tables.
1 parent 4841c31 commit 60aec01

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/render.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
import {ok as assert} from 'devlop'
99
import {toString} from 'hast-util-to-string'
1010
import {fromMarkdown} from 'mdast-util-from-markdown'
11+
import {gfmFromMarkdown} from 'mdast-util-gfm'
1112
import {toHast} from 'mdast-util-to-hast'
13+
import {gfm} from 'micromark-extension-gfm'
1214
import {removePosition} from 'unist-util-remove-position'
1315
import {SKIP, visitParents} from 'unist-util-visit-parents'
1416

@@ -294,7 +296,10 @@ export function query(state, annotation, between) {
294296
function createInfo(state, annotation) {
295297
/** @type {Root} */
296298
const tree = annotation.docs
297-
? fromMarkdown(annotation.docs)
299+
? fromMarkdown(annotation.docs, {
300+
extensions: [gfm()],
301+
mdastExtensions: [gfmFromMarkdown()]
302+
})
298303
: {type: 'root', children: []}
299304
const tags = annotation.tags || []
300305
/** @type {List} */

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@
4040
"devlop": "^1.0.0",
4141
"hast-util-to-string": "^3.0.0",
4242
"mdast-util-from-markdown": "^2.0.0",
43+
"mdast-util-gfm": "^3.0.0",
4344
"mdast-util-to-hast": "^13.0.0",
45+
"micromark-extension-gfm": "^3.0.0",
4446
"micromark-util-character": "^2.0.0",
4547
"twoslash": "^0.2.0",
4648
"unist-util-remove-position": "^5.0.0",

0 commit comments

Comments
 (0)