Skip to content

Commit

Permalink
Add folding for table nodes
Browse files Browse the repository at this point in the history
FIX: Support code folding for GFM tables.

Closes lezer-parser/markdown#30
  • Loading branch information
marijnh committed Nov 3, 2023
1 parent 9028332 commit 30ba4c9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ export function mkLang(parser: MarkdownParser) {
/// Language support for strict CommonMark.
export const commonmarkLanguage = mkLang(commonmark)

const extended = commonmark.configure([GFM, Subscript, Superscript, Emoji])
const extended = commonmark.configure([GFM, Subscript, Superscript, Emoji, {
props: [
foldNodeProp.add({
Table: (tree, state) => ({from: state.doc.lineAt(tree.from).to, to: tree.to})
})
]
}])

/// Language support for [GFM](https://github.github.com/gfm/) plus
/// subscript, superscript, and emoji syntax.
Expand Down

0 comments on commit 30ba4c9

Please sign in to comment.