From 30ba4c90a00a88ca48c7073decf3a1cfea0fb1bf Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Fri, 3 Nov 2023 22:47:08 +0100 Subject: [PATCH] Add folding for table nodes FIX: Support code folding for GFM tables. Closes https://github.com/lezer-parser/markdown/issues/30 --- src/markdown.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/markdown.ts b/src/markdown.ts index 28bc8a2..7d91821 100644 --- a/src/markdown.ts +++ b/src/markdown.ts @@ -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.