Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Commit 02b44df

Browse files
authored
feat: parse gridtables
1 parent 59e5aab commit 02b44df

8 files changed

+379
-79
lines changed

Diff for: .eslintrc.cjs

+6
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,10 @@ module.exports = {
3030
__rootdir: true,
3131
__testdir: true,
3232
},
33+
plugins: ['import'],
34+
settings: {
35+
'import/resolver': {
36+
exports: {},
37+
},
38+
},
3339
};

Diff for: package-lock.json

+56-77
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"node": ">=16.x"
3434
},
3535
"dependencies": {
36-
"@adobe/helix-markdown-support": "3.1.8",
36+
"@adobe/helix-markdown-support": "5.0.7",
3737
"@adobe/helix-shared-utils": "2.0.11",
3838
"cookie": "0.5.0",
3939
"github-slugger": "1.4.0",
@@ -76,6 +76,7 @@
7676
"@semantic-release/npm": "9.0.1",
7777
"c8": "7.12.0",
7878
"eslint": "8.23.0",
79+
"eslint-import-resolver-exports": "1.0.0-beta.2",
7980
"eslint-plugin-header": "3.1.1",
8081
"eslint-plugin-import": "2.26.0",
8182
"esmock": "1.9.8",

Diff for: src/steps/parse-markdown.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
import { unified } from 'unified';
1313
import remarkParse from 'remark-parse';
1414
import { removePosition } from 'unist-util-remove-position';
15-
import { remarkMatter } from '@adobe/helix-markdown-support';
15+
import { dereference } from '@adobe/helix-markdown-support';
16+
import { remarkMatter } from '@adobe/helix-markdown-support/matter';
17+
import { remarkGridTable } from '@adobe/helix-markdown-support/gridtable';
1618
import remarkGfm from '../utils/remark-gfm-nolink.js';
1719

1820
export class FrontmatterParsingError extends Error {
@@ -36,7 +38,9 @@ export default function parseMarkdown(state) {
3638
log.warn(new FrontmatterParsingError(e));
3739
},
3840
})
41+
.use(remarkGridTable)
3942
.parse(converted);
4043

4144
removePosition(content.mdast, true);
45+
dereference(content.mdast);
4246
}

Diff for: src/utils/mdast-to-hast.js

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*/
1212
import { toHast as mdast2hast, defaultHandlers } from 'mdast-util-to-hast';
1313
import { raw } from 'hast-util-raw';
14+
import { mdast2hastGridTableHandler, TYPE_TABLE } from '@adobe/helix-markdown-support/gridtable';
1415

1516
import section from './section-handler.js';
1617
import heading from './heading-handler.js';
@@ -27,6 +28,7 @@ export default function getHast(mdast, slugger) {
2728
...defaultHandlers,
2829
section: section(),
2930
heading: heading(slugger),
31+
[TYPE_TABLE]: mdast2hastGridTableHandler(),
3032
},
3133
allowDangerousHtml: true,
3234
});

0 commit comments

Comments
 (0)