Skip to content

Commit cfba681

Browse files
authored
feat: support html comments in mdx files (#205)
1 parent 8ac2182 commit cfba681

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

api/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"rehype-accessible-emojis": "^0.3.2",
3636
"rehype-katex": "^6.0.2",
3737
"rehype-slug": "^5.0.0",
38+
"remark-comment": "^1.0.0",
3839
"remark-gfm": "^3.0.1",
3940
"remark-math": "^5.1.1",
4041
"remark-parse": "^10.0.1",

api/src/utils/getPlugins.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ import rehypeSlug from 'rehype-slug';
88
import remarkMath from 'remark-math';
99
import rehypeKatex from 'rehype-katex';
1010
import { OutputConfig } from '@docs.page/server';
11+
import remarkComment from 'remark-comment';
1112

1213
function getPlugins(config: OutputConfig) {
1314
//
1415
const remarkPlugins = config?.experimentalCodehike
15-
? [remarkGfm, [remarkCodeHike, { theme, lineNumbers: true }]]
16-
: [remarkGfm];
16+
? [remarkGfm, remarkComment, [remarkCodeHike, { theme, lineNumbers: true }]]
17+
: [remarkGfm, remarkComment];
1718

1819
const rehypePlugins = config?.experimentalCodehike
1920
? [rehypeSlug, rehypeInlineBadges, rehypeAccessibleEmojis]

yarn.lock

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7086,7 +7086,7 @@ micromark-factory-whitespace@^1.0.0:
70867086
micromark-util-symbol "^1.0.0"
70877087
micromark-util-types "^1.0.0"
70887088

7089-
micromark-util-character@^1.0.0:
7089+
micromark-util-character@^1.0.0, micromark-util-character@^1.1.0:
70907090
version "1.1.0"
70917091
resolved "https://registry.yarnpkg.com/micromark-util-character/-/micromark-util-character-1.1.0.tgz#d97c54d5742a0d9611a68ca0cd4124331f264d86"
70927092
integrity sha512-agJ5B3unGNJ9rJvADMJ5ZiYjBRyDpzKAOk01Kpi1TKhlT1APx3XZk6eN7RtSz1erbWHC2L8T3xLZ81wdtGRZzg==
@@ -7191,7 +7191,7 @@ micromark-util-subtokenize@^1.0.0:
71917191
micromark-util-types "^1.0.0"
71927192
uvu "^0.5.0"
71937193

7194-
micromark-util-symbol@^1.0.0:
7194+
micromark-util-symbol@^1.0.0, micromark-util-symbol@^1.0.1:
71957195
version "1.0.1"
71967196
resolved "https://registry.yarnpkg.com/micromark-util-symbol/-/micromark-util-symbol-1.0.1.tgz#b90344db62042ce454f351cf0bebcc0a6da4920e"
71977197
integrity sha512-oKDEMK2u5qqAptasDAwWDXq0tG9AssVwAx3E9bBF3t/shRIGsWIRG+cGafs2p/SnDSOecnt6hZPCE2o6lHfFmQ==
@@ -8744,6 +8744,15 @@ rehype-slug@^5.0.0:
87448744
unified "^10.0.0"
87458745
unist-util-visit "^4.0.0"
87468746

8747+
remark-comment@^1.0.0:
8748+
version "1.0.0"
8749+
resolved "https://registry.yarnpkg.com/remark-comment/-/remark-comment-1.0.0.tgz#befe2fd5dde688d641542cd1206130e00b79a337"
8750+
integrity sha512-k8YPo5MGvl8l4gGxOH6Zk4Fa2AhDACN5eqKnKZcHDORZQS15hlnezlBHj2lqyDiqzApNmYOMTibkEJbMSKU25w==
8751+
dependencies:
8752+
micromark-factory-space "^1.0.0"
8753+
micromark-util-character "^1.1.0"
8754+
micromark-util-symbol "^1.0.1"
8755+
87478756
remark-frontmatter@^4.0.0, remark-frontmatter@^4.0.1:
87488757
version "4.0.1"
87498758
resolved "https://registry.yarnpkg.com/remark-frontmatter/-/remark-frontmatter-4.0.1.tgz#84560f7ccef114ef076d3d3735be6d69f8922309"

0 commit comments

Comments
 (0)