livemark 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/build/actions/changelog/build.js +4 -8
  2. package/build/actions/config/load.js +1 -1
  3. package/build/actions/config/load.unit.js +1 -1
  4. package/build/actions/target/build.js +2 -5
  5. package/build/commands/build.js +1 -1
  6. package/build/commands/escape.js +1 -1
  7. package/build/commands/preview.js +1 -1
  8. package/build/commands/start.js +1 -1
  9. package/build/components/Abbr.js +2 -2
  10. package/build/components/Article.js +2 -2
  11. package/build/components/BlogIndex.js +2 -4
  12. package/build/components/Callout.js +1 -1
  13. package/build/components/ChangelogIndex.js +1 -1
  14. package/build/components/CodeBlock.js +3 -5
  15. package/build/components/CodeTabs.js +1 -1
  16. package/build/components/Columns.js +2 -4
  17. package/build/components/Content.js +2 -2
  18. package/build/components/ContentTab.js +1 -1
  19. package/build/components/ContentTabs.js +1 -1
  20. package/build/components/DefinitionList.js +1 -1
  21. package/build/components/FileTree.js +1 -1
  22. package/build/components/FootnoteRef.js +2 -2
  23. package/build/components/InlineToc.js +1 -1
  24. package/build/components/Layout.js +1 -1
  25. package/build/components/LinkButton.js +1 -1
  26. package/build/components/Mermaid.js +1 -1
  27. package/build/components/PackageTabs.js +2 -2
  28. package/build/components/PageToolbar.js +2 -2
  29. package/build/components/PrevNext.js +3 -7
  30. package/build/components/SearchDialog.js +1 -1
  31. package/build/components/SectionHeader.js +1 -1
  32. package/build/components/Sidebar.js +2 -2
  33. package/build/components/SidebarArticles.js +2 -2
  34. package/build/components/SidebarLinks.js +2 -2
  35. package/build/components/TagIndex.js +2 -4
  36. package/build/components/Toc.js +1 -1
  37. package/build/content/article.js +1 -1
  38. package/build/content-collections.js +2 -4
  39. package/build/elements/alert-dialog.js +4 -4
  40. package/build/elements/alert.js +1 -1
  41. package/build/elements/avatar.d.ts +1 -1
  42. package/build/elements/avatar.js +2 -2
  43. package/build/elements/badge.js +1 -1
  44. package/build/elements/breadcrumb.js +1 -1
  45. package/build/elements/button-group.d.ts +1 -1
  46. package/build/elements/button-group.js +2 -2
  47. package/build/elements/calendar.js +4 -4
  48. package/build/elements/carousel.js +1 -1
  49. package/build/elements/chart.js +4 -14
  50. package/build/elements/collapsible.js +3 -3
  51. package/build/elements/command.js +1 -1
  52. package/build/elements/context-menu.js +4 -4
  53. package/build/elements/dialog.js +1 -1
  54. package/build/elements/direction.d.ts +1 -1
  55. package/build/elements/direction.js +2 -2
  56. package/build/elements/drawer.js +1 -1
  57. package/build/elements/dropdown-menu.js +2 -2
  58. package/build/elements/empty.d.ts +1 -1
  59. package/build/elements/empty.js +2 -2
  60. package/build/elements/field.js +1 -1
  61. package/build/elements/hover-card.js +2 -2
  62. package/build/elements/input-group.js +1 -1
  63. package/build/elements/item.js +1 -1
  64. package/build/elements/menubar.js +1 -1
  65. package/build/elements/native-select.js +1 -1
  66. package/build/elements/navigation-menu.js +1 -1
  67. package/build/elements/pagination.js +2 -2
  68. package/build/elements/popover.js +1 -1
  69. package/build/elements/progress.d.ts +1 -1
  70. package/build/elements/progress.js +2 -2
  71. package/build/elements/resizable.js +2 -2
  72. package/build/elements/scroll-area.js +1 -1
  73. package/build/elements/select.js +1 -1
  74. package/build/elements/sheet.js +1 -1
  75. package/build/elements/sidebar.js +2 -3
  76. package/build/elements/table.js +1 -1
  77. package/build/elements/toggle-group.js +1 -1
  78. package/build/elements/tooltip.js +1 -1
  79. package/build/helpers/changelog-source.js +1 -1
  80. package/build/helpers/dynamic-icon-resolver.js +1 -1
  81. package/build/helpers/resolve-asset-path.unit.js +1 -1
  82. package/build/helpers/resolve-base.unit.js +2 -2
  83. package/build/helpers/resolve-includes.js +2 -2
  84. package/build/helpers/resolve-includes.unit.js +1 -1
  85. package/build/helpers/rss.js +2 -4
  86. package/build/helpers/rss.unit.js +1 -1
  87. package/build/helpers/section.js +2 -3
  88. package/build/helpers/section.unit.js +4 -13
  89. package/build/helpers/toc.unit.js +2 -4
  90. package/build/plugins/rehype-inline-code.js +2 -2
  91. package/build/plugins/rehype-task-list-a11y.js +1 -1
  92. package/build/plugins/remark-abbr.js +2 -4
  93. package/build/plugins/remark-ansi.js +2 -4
  94. package/build/plugins/remark-ansi.unit.js +1 -1
  95. package/build/plugins/remark-badge.js +2 -4
  96. package/build/plugins/remark-button.unit.js +1 -1
  97. package/build/plugins/remark-callout.js +1 -1
  98. package/build/plugins/remark-card.js +1 -1
  99. package/build/plugins/remark-code-tabs.js +4 -8
  100. package/build/plugins/remark-columns.js +1 -1
  101. package/build/plugins/remark-custom-heading-id.unit.js +1 -1
  102. package/build/plugins/remark-deflist.js +1 -1
  103. package/build/plugins/remark-details.js +2 -4
  104. package/build/plugins/remark-filetree.js +1 -1
  105. package/build/plugins/remark-filetree.unit.js +1 -1
  106. package/build/plugins/remark-media.js +3 -7
  107. package/build/plugins/remark-media.unit.js +1 -1
  108. package/build/plugins/remark-steps.unit.js +1 -1
  109. package/build/plugins/remark-tab.js +4 -2
  110. package/build/plugins/remark-tab.unit.js +3 -7
  111. package/build/plugins/remark-toc.unit.js +1 -1
  112. package/build/plugins/shiki-icon.js +1 -1
  113. package/build/plugins/shiki-line-highlight.js +1 -1
  114. package/build/plugins/vite-livemark.js +1 -1
  115. package/build/plugins/vite-robots.js +1 -1
  116. package/build/plugins/vite-robots.unit.js +1 -1
  117. package/build/routes/$.js +1 -1
  118. package/build/vite.config.js +3 -8
  119. package/package.json +2 -2
  120. package/skills/configuration/SKILL.md +1 -3
  121. package/source/actions/changelog/build.ts +4 -20
  122. package/source/actions/config/load.ts +1 -3
  123. package/source/actions/config/load.unit.ts +2 -7
  124. package/source/actions/target/build.ts +1 -4
  125. package/source/commands/build.ts +1 -7
  126. package/source/commands/escape.ts +3 -8
  127. package/source/commands/preview.ts +1 -7
  128. package/source/commands/start.ts +1 -7
  129. package/source/components/Abbr.tsx +1 -5
  130. package/source/components/Article.tsx +1 -5
  131. package/source/components/BlogIndex.tsx +3 -9
  132. package/source/components/Callout.tsx +1 -6
  133. package/source/components/ChangelogIndex.tsx +1 -3
  134. package/source/components/CodeBlock.tsx +4 -14
  135. package/source/components/CodeTabs.tsx +1 -3
  136. package/source/components/Columns.tsx +1 -3
  137. package/source/components/Content.tsx +1 -5
  138. package/source/components/ContentTab.tsx +1 -4
  139. package/source/components/ContentTabs.tsx +3 -10
  140. package/source/components/DefinitionList.tsx +1 -4
  141. package/source/components/FileTree.tsx +1 -5
  142. package/source/components/FootnoteRef.tsx +1 -5
  143. package/source/components/InlineToc.tsx +1 -4
  144. package/source/components/Layout.tsx +3 -10
  145. package/source/components/LinkButton.tsx +1 -7
  146. package/source/components/Mermaid.tsx +1 -3
  147. package/source/components/PackageTabs.tsx +1 -5
  148. package/source/components/PageToolbar.tsx +1 -5
  149. package/source/components/PrevNext.tsx +2 -6
  150. package/source/components/SearchDialog.tsx +2 -6
  151. package/source/components/SectionHeader.tsx +1 -7
  152. package/source/components/Sidebar.tsx +2 -7
  153. package/source/components/SidebarArticles.tsx +4 -20
  154. package/source/components/SidebarLinks.tsx +2 -6
  155. package/source/components/TagIndex.tsx +3 -9
  156. package/source/components/Toc.tsx +2 -7
  157. package/source/content/article.ts +1 -2
  158. package/source/content-collections.ts +2 -5
  159. package/source/elements/alert-dialog.tsx +7 -29
  160. package/source/elements/alert.tsx +1 -4
  161. package/source/elements/avatar.tsx +4 -20
  162. package/source/elements/badge.tsx +2 -4
  163. package/source/elements/breadcrumb.tsx +3 -13
  164. package/source/elements/button-group.tsx +1 -6
  165. package/source/elements/calendar.tsx +6 -23
  166. package/source/elements/carousel.tsx +3 -10
  167. package/source/elements/chart.tsx +8 -33
  168. package/source/elements/collapsible.tsx +2 -6
  169. package/source/elements/command.tsx +3 -12
  170. package/source/elements/context-menu.tsx +7 -24
  171. package/source/elements/dialog.tsx +3 -13
  172. package/source/elements/direction.tsx +1 -4
  173. package/source/elements/drawer.tsx +3 -9
  174. package/source/elements/dropdown-menu.tsx +4 -18
  175. package/source/elements/empty.tsx +2 -12
  176. package/source/elements/field.tsx +2 -6
  177. package/source/elements/hover-card.tsx +1 -3
  178. package/source/elements/input-group.tsx +14 -27
  179. package/source/elements/item.tsx +3 -12
  180. package/source/elements/menubar.tsx +4 -13
  181. package/source/elements/native-select.tsx +3 -14
  182. package/source/elements/navigation-menu.tsx +1 -4
  183. package/source/elements/pagination.tsx +3 -13
  184. package/source/elements/popover.tsx +1 -4
  185. package/source/elements/progress.tsx +3 -15
  186. package/source/elements/resizable.tsx +3 -11
  187. package/source/elements/scroll-area.tsx +1 -5
  188. package/source/elements/select.tsx +3 -13
  189. package/source/elements/sheet.tsx +2 -9
  190. package/source/elements/sidebar.tsx +6 -24
  191. package/source/elements/table.tsx +3 -12
  192. package/source/elements/toggle-group.tsx +1 -3
  193. package/source/elements/tooltip.tsx +2 -9
  194. package/source/helpers/changelog-source.ts +1 -3
  195. package/source/helpers/dynamic-icon-resolver.tsx +1 -4
  196. package/source/helpers/resolve-asset-path.unit.ts +6 -12
  197. package/source/helpers/resolve-base.unit.ts +1 -2
  198. package/source/helpers/resolve-includes.ts +2 -8
  199. package/source/helpers/resolve-includes.unit.ts +9 -36
  200. package/source/helpers/rss.ts +3 -9
  201. package/source/helpers/rss.unit.ts +1 -3
  202. package/source/helpers/section.ts +1 -4
  203. package/source/helpers/section.unit.ts +5 -18
  204. package/source/helpers/toc.unit.ts +1 -3
  205. package/source/plugins/rehype-inline-code.ts +5 -21
  206. package/source/plugins/rehype-task-list-a11y.ts +1 -2
  207. package/source/plugins/remark-abbr.ts +1 -3
  208. package/source/plugins/remark-ansi.ts +2 -5
  209. package/source/plugins/remark-ansi.unit.ts +6 -18
  210. package/source/plugins/remark-badge.ts +1 -3
  211. package/source/plugins/remark-button.unit.ts +3 -9
  212. package/source/plugins/remark-callout.ts +35 -40
  213. package/source/plugins/remark-card.ts +25 -29
  214. package/source/plugins/remark-code-tabs.ts +3 -7
  215. package/source/plugins/remark-columns.ts +13 -17
  216. package/source/plugins/remark-custom-heading-id.unit.ts +2 -6
  217. package/source/plugins/remark-deflist.ts +1 -2
  218. package/source/plugins/remark-details.ts +28 -34
  219. package/source/plugins/remark-filetree.ts +28 -34
  220. package/source/plugins/remark-filetree.unit.ts +1 -4
  221. package/source/plugins/remark-media.ts +2 -6
  222. package/source/plugins/remark-media.unit.ts +2 -6
  223. package/source/plugins/remark-steps.unit.ts +2 -7
  224. package/source/plugins/remark-tab.ts +26 -30
  225. package/source/plugins/remark-tab.unit.ts +2 -6
  226. package/source/plugins/remark-toc.unit.ts +1 -3
  227. package/source/plugins/shiki-icon.ts +1 -4
  228. package/source/plugins/shiki-line-highlight.ts +4 -11
  229. package/source/plugins/vite-livemark.ts +3 -10
  230. package/source/plugins/vite-robots.ts +1 -6
  231. package/source/plugins/vite-robots.unit.ts +1 -3
  232. package/source/routes/$.tsx +1 -3
  233. package/source/styles/general.css +1 -5
  234. package/source/vite.config.ts +2 -7
@@ -6,39 +6,35 @@ import { visit, SKIP } from "unist-util-visit"
6
6
  /** Remark plugin that converts :::card directives into Card/Cards JSX elements */
7
7
  export const remarkCard: Plugin<[], Root> = () => {
8
8
  return tree => {
9
- visit(
10
- tree,
11
- "containerDirective",
12
- (node: ContainerDirective, index, parent) => {
13
- if (node.name !== "card" || index === undefined || !parent) return
9
+ visit(tree, "containerDirective", (node: ContainerDirective, index, parent) => {
10
+ if (node.name !== "card" || index === undefined || !parent) return
14
11
 
15
- const title = node.attributes?.title ?? ""
16
- const href = node.attributes?.href
17
- const icon = node.attributes?.icon
12
+ const title = node.attributes?.title ?? ""
13
+ const href = node.attributes?.href
14
+ const icon = node.attributes?.icon
18
15
 
19
- const attributes = [
20
- { type: "mdxJsxAttribute" as const, name: "title", value: title },
21
- ...(href
22
- ? [{ type: "mdxJsxAttribute" as const, name: "href", value: href }]
23
- : []),
24
- ...(icon
25
- ? [{ type: "mdxJsxAttribute" as const, name: "icon", value: icon }]
26
- : []),
27
- ]
16
+ const attributes = [
17
+ { type: "mdxJsxAttribute" as const, name: "title", value: title },
18
+ ...(href
19
+ ? [{ type: "mdxJsxAttribute" as const, name: "href", value: href }]
20
+ : []),
21
+ ...(icon
22
+ ? [{ type: "mdxJsxAttribute" as const, name: "icon", value: icon }]
23
+ : []),
24
+ ]
28
25
 
29
- const jsxNode = {
30
- type: "mdxJsxFlowElement" as const,
31
- name: "Card",
32
- attributes,
33
- children: node.children,
34
- data: { _mdxExplicitJsx: true },
35
- }
26
+ const jsxNode = {
27
+ type: "mdxJsxFlowElement" as const,
28
+ name: "Card",
29
+ attributes,
30
+ children: node.children,
31
+ data: { _mdxExplicitJsx: true },
32
+ }
36
33
 
37
- // @ts-expect-error mdxJsxFlowElement is not in mdast types
38
- parent.children[index] = jsxNode
39
- return SKIP
40
- },
41
- )
34
+ // @ts-expect-error mdxJsxFlowElement is not in mdast types
35
+ parent.children[index] = jsxNode
36
+ return SKIP
37
+ })
42
38
 
43
39
  const children = tree.children
44
40
  let i = 0
@@ -23,9 +23,7 @@ export const remarkCodeTabs: Plugin<[], Root> = () => {
23
23
  continue
24
24
  }
25
25
 
26
- const group: { name: string; code: Code }[] = [
27
- { name: firstMatch[1]!, code: node },
28
- ]
26
+ const group: { name: string; code: Code }[] = [{ name: firstMatch[1]!, code: node }]
29
27
 
30
28
  let j = i + 1
31
29
  while (j < children.length) {
@@ -47,10 +45,8 @@ export const remarkCodeTabs: Plugin<[], Root> = () => {
47
45
 
48
46
  for (const item of group) {
49
47
  item.code.meta =
50
- item.code
51
- .meta!.replace(TAB_PATTERN, "")
52
- .replace(SYNC_PATTERN, "")
53
- .trim() || null
48
+ item.code.meta!.replace(TAB_PATTERN, "").replace(SYNC_PATTERN, "").trim() ||
49
+ null
54
50
  }
55
51
 
56
52
  const codeTabsAttrs: {
@@ -6,25 +6,21 @@ import { visit, SKIP } from "unist-util-visit"
6
6
  /** Remark plugin that converts consecutive :::column directives into a Columns grid */
7
7
  export const remarkColumns: Plugin<[], Root> = () => {
8
8
  return tree => {
9
- visit(
10
- tree,
11
- "containerDirective",
12
- (node: ContainerDirective, index, parent) => {
13
- if (node.name !== "column" || index === undefined || !parent) return
9
+ visit(tree, "containerDirective", (node: ContainerDirective, index, parent) => {
10
+ if (node.name !== "column" || index === undefined || !parent) return
14
11
 
15
- const jsxNode = {
16
- type: "mdxJsxFlowElement" as const,
17
- name: "Column",
18
- attributes: [],
19
- children: node.children,
20
- data: { _mdxExplicitJsx: true },
21
- }
12
+ const jsxNode = {
13
+ type: "mdxJsxFlowElement" as const,
14
+ name: "Column",
15
+ attributes: [],
16
+ children: node.children,
17
+ data: { _mdxExplicitJsx: true },
18
+ }
22
19
 
23
- // @ts-expect-error mdxJsxFlowElement is not in mdast types
24
- parent.children[index] = jsxNode
25
- return SKIP
26
- },
27
- )
20
+ // @ts-expect-error mdxJsxFlowElement is not in mdast types
21
+ parent.children[index] = jsxNode
22
+ return SKIP
23
+ })
28
24
 
29
25
  const children = tree.children
30
26
  let i = 0
@@ -75,18 +75,14 @@ describe("transformHeadingAnnotations", () => {
75
75
  })
76
76
 
77
77
  it("should handle ids with hyphens and numbers", () => {
78
- const tree = process(
79
- makeTree(makeHeading(2, "Section 1 [#section-1-intro]")),
80
- )
78
+ const tree = process(makeTree(makeHeading(2, "Section 1 [#section-1-intro]")))
81
79
  const heading = findHeading(tree, 0)
82
80
  expect(heading.data?.hProperties).toEqual({ id: "section-1-intro" })
83
81
  expect(headingText(heading)).toBe("Section 1")
84
82
  })
85
83
 
86
84
  it("should preserve inline formatting before the id", () => {
87
- const tree = process(
88
- makeTree(makeBoldHeading("Bold", " heading [#bold-heading]")),
89
- )
85
+ const tree = process(makeTree(makeBoldHeading("Bold", " heading [#bold-heading]")))
90
86
  const heading = findHeading(tree, 0)
91
87
  expect(heading.data?.hProperties).toEqual({ id: "bold-heading" })
92
88
  expect(heading.children.some(c => c.type === "strong")).toBe(true)
@@ -9,8 +9,7 @@ export const remarkDeflist: Plugin<[], Root> = () => {
9
9
  if (index === undefined || !parent) return
10
10
 
11
11
  const children = node.children.map(child => {
12
- const name =
13
- child.type === "defListTerm" ? "DefinitionTerm" : "DefinitionDetail"
12
+ const name = child.type === "defListTerm" ? "DefinitionTerm" : "DefinitionDetail"
14
13
  return {
15
14
  type: "mdxJsxFlowElement" as const,
16
15
  name,
@@ -6,44 +6,38 @@ import { visit } from "unist-util-visit"
6
6
  /** Remark plugin that converts :::details directives into collapsible details/summary elements */
7
7
  export const remarkDetails: Plugin<[], Root> = () => {
8
8
  return tree => {
9
- visit(
10
- tree,
11
- "containerDirective",
12
- (node: ContainerDirective, index, parent) => {
13
- if (node.name !== "details" || index === undefined || !parent) return
9
+ visit(tree, "containerDirective", (node: ContainerDirective, index, parent) => {
10
+ if (node.name !== "details" || index === undefined || !parent) return
14
11
 
15
- const labelParagraph = node.children.find(
16
- (child): child is Paragraph =>
17
- child.type === "paragraph" && !!child.data?.directiveLabel,
18
- )
12
+ const labelParagraph = node.children.find(
13
+ (child): child is Paragraph =>
14
+ child.type === "paragraph" && !!child.data?.directiveLabel,
15
+ )
19
16
 
20
- const summary = labelParagraph
21
- ? labelParagraph.children
22
- .map(c => ("value" in c ? String(c.value) : ""))
23
- .join("")
24
- : "Details"
17
+ const summary = labelParagraph
18
+ ? labelParagraph.children.map(c => ("value" in c ? String(c.value) : "")).join("")
19
+ : "Details"
25
20
 
26
- const body = node.children.filter(
27
- child => !(child.type === "paragraph" && child.data?.directiveLabel),
28
- )
21
+ const body = node.children.filter(
22
+ child => !(child.type === "paragraph" && child.data?.directiveLabel),
23
+ )
29
24
 
30
- const jsxNode = {
31
- type: "mdxJsxFlowElement" as const,
32
- name: "Details",
33
- attributes: [
34
- {
35
- type: "mdxJsxAttribute" as const,
36
- name: "summary",
37
- value: summary,
38
- },
39
- ],
40
- children: body,
41
- data: { _mdxExplicitJsx: true },
42
- }
25
+ const jsxNode = {
26
+ type: "mdxJsxFlowElement" as const,
27
+ name: "Details",
28
+ attributes: [
29
+ {
30
+ type: "mdxJsxAttribute" as const,
31
+ name: "summary",
32
+ value: summary,
33
+ },
34
+ ],
35
+ children: body,
36
+ data: { _mdxExplicitJsx: true },
37
+ }
43
38
 
44
- // @ts-expect-error mdxJsxFlowElement is not in mdast types
45
- parent.children.splice(index, 1, jsxNode)
46
- },
47
- )
39
+ // @ts-expect-error mdxJsxFlowElement is not in mdast types
40
+ parent.children.splice(index, 1, jsxNode)
41
+ })
48
42
  }
49
43
  }
@@ -51,39 +51,33 @@ function parseListItem(listItem: ListItem): TreeItem | undefined {
51
51
  /** Remark plugin that converts :::filetree directives into FileTree JSX elements */
52
52
  export const remarkFiletree: Plugin<[], Root> = () => {
53
53
  return tree => {
54
- visit(
55
- tree,
56
- "containerDirective",
57
- (node: ContainerDirective, index, parent) => {
58
- if (node.name !== "filetree" || index === undefined || !parent) return
59
-
60
- const lists = node.children.filter(
61
- (child): child is List => child.type === "list",
62
- )
63
-
64
- const treeItems: TreeItem[] = []
65
- for (const list of lists) {
66
- treeItems.push(...parseList(list))
67
- }
68
-
69
- const jsxNode = {
70
- type: "mdxJsxFlowElement" as const,
71
- name: "FileTree",
72
- attributes: [
73
- {
74
- type: "mdxJsxAttribute" as const,
75
- name: "tree",
76
- value: JSON.stringify(treeItems),
77
- },
78
- ],
79
- children: [],
80
- data: { _mdxExplicitJsx: true },
81
- }
82
-
83
- // @ts-expect-error mdxJsxFlowElement is not in mdast types
84
- parent.children[index] = jsxNode
85
- return SKIP
86
- },
87
- )
54
+ visit(tree, "containerDirective", (node: ContainerDirective, index, parent) => {
55
+ if (node.name !== "filetree" || index === undefined || !parent) return
56
+
57
+ const lists = node.children.filter((child): child is List => child.type === "list")
58
+
59
+ const treeItems: TreeItem[] = []
60
+ for (const list of lists) {
61
+ treeItems.push(...parseList(list))
62
+ }
63
+
64
+ const jsxNode = {
65
+ type: "mdxJsxFlowElement" as const,
66
+ name: "FileTree",
67
+ attributes: [
68
+ {
69
+ type: "mdxJsxAttribute" as const,
70
+ name: "tree",
71
+ value: JSON.stringify(treeItems),
72
+ },
73
+ ],
74
+ children: [],
75
+ data: { _mdxExplicitJsx: true },
76
+ }
77
+
78
+ // @ts-expect-error mdxJsxFlowElement is not in mdast types
79
+ parent.children[index] = jsxNode
80
+ return SKIP
81
+ })
88
82
  }
89
83
  }
@@ -98,10 +98,7 @@ describe("parseList", () => {
98
98
  listItem(
99
99
  paragraph(text("b/")),
100
100
  list(
101
- listItem(
102
- paragraph(text("c/")),
103
- list(listItem(paragraph(text("deep.ts")))),
104
- ),
101
+ listItem(paragraph(text("c/")), list(listItem(paragraph(text("deep.ts"))))),
105
102
  ),
106
103
  ),
107
104
  ),
@@ -23,9 +23,7 @@ export function transformMediaDirectives(tree: Root) {
23
23
  const jsxNode = {
24
24
  type: "mdxJsxFlowElement" as const,
25
25
  name: "YouTube",
26
- attributes: [
27
- { type: "mdxJsxAttribute" as const, name: "id", value: id },
28
- ],
26
+ attributes: [{ type: "mdxJsxAttribute" as const, name: "id", value: id }],
29
27
  children: [],
30
28
  data: { _mdxExplicitJsx: true },
31
29
  }
@@ -41,9 +39,7 @@ export function transformMediaDirectives(tree: Root) {
41
39
  const jsxNode = {
42
40
  type: "mdxJsxFlowElement" as const,
43
41
  name: "SoundCloud",
44
- attributes: [
45
- { type: "mdxJsxAttribute" as const, name: "url", value: url },
46
- ],
42
+ attributes: [{ type: "mdxJsxAttribute" as const, name: "url", value: url }],
47
43
  children: [],
48
44
  data: { _mdxExplicitJsx: true },
49
45
  }
@@ -57,17 +57,13 @@ describe("transformMediaDirectives", () => {
57
57
  })
58
58
 
59
59
  it("should skip audio directive without url", () => {
60
- const tree = process(
61
- makeTree(makeLeafDirective("audio", { type: "soundcloud" })),
62
- )
60
+ const tree = process(makeTree(makeLeafDirective("audio", { type: "soundcloud" })))
63
61
  const node = tree.children[0]
64
62
  expect(node).toMatchObject({ type: "leafDirective", name: "audio" })
65
63
  })
66
64
 
67
65
  it("should ignore unrelated leaf directives", () => {
68
- const tree = process(
69
- makeTree(makeLeafDirective("include", { file: "test.md" })),
70
- )
66
+ const tree = process(makeTree(makeLeafDirective("include", { file: "test.md" })))
71
67
  const node = tree.children[0]
72
68
  expect(node).toMatchObject({ type: "leafDirective", name: "include" })
73
69
  })
@@ -30,9 +30,7 @@ describe("transformStepHeadings", () => {
30
30
  }
31
31
 
32
32
  it("should strip [step] and set data-step attribute", () => {
33
- const tree = process(
34
- makeTree(makeHeading(3, "Install Dependencies [step]")),
35
- )
33
+ const tree = process(makeTree(makeHeading(3, "Install Dependencies [step]")))
36
34
  const heading = findHeading(tree, 0)
37
35
  expect(heading.data?.hProperties).toEqual({ "data-step": 1 })
38
36
  expect(headingText(heading)).toBe("Install Dependencies")
@@ -75,10 +73,7 @@ describe("transformStepHeadings", () => {
75
73
 
76
74
  it("should handle different heading depths", () => {
77
75
  const tree = process(
78
- makeTree(
79
- makeHeading(2, "Big Step [step]"),
80
- makeHeading(4, "Small Step [step]"),
81
- ),
76
+ makeTree(makeHeading(2, "Big Step [step]"), makeHeading(4, "Small Step [step]")),
82
77
  )
83
78
 
84
79
  expect(findHeading(tree, 0).data?.hProperties).toEqual({ "data-step": 1 })
@@ -5,38 +5,35 @@ import { visit, SKIP } from "unist-util-visit"
5
5
 
6
6
  /** Walk a mdast tree and convert :::tab directives into ContentTab/ContentTabs JSX elements */
7
7
  export function transformTabDirectives(tree: Root) {
8
- visit(
9
- tree,
10
- "containerDirective",
11
- (node: ContainerDirective, index, parent) => {
12
- if (node.name !== "tab" || index === undefined || !parent) return
8
+ visit(tree, "containerDirective", (node: ContainerDirective, index, parent) => {
9
+ if (node.name !== "tab" || index === undefined || !parent) return
13
10
 
14
- const title = node.attributes?.title ?? ""
15
- const sync = node.attributes?.sync
11
+ const title = node.attributes?.title ?? ""
12
+ const sync = node.attributes?.sync
16
13
 
17
- const attrs: { type: "mdxJsxAttribute"; name: string; value: string }[] =
18
- [{ type: "mdxJsxAttribute" as const, name: "title", value: title }]
19
- if (sync) {
20
- attrs.push({
21
- type: "mdxJsxAttribute" as const,
22
- name: "sync",
23
- value: sync,
24
- })
25
- }
14
+ const attrs: { type: "mdxJsxAttribute"; name: string; value: string }[] = [
15
+ { type: "mdxJsxAttribute" as const, name: "title", value: title },
16
+ ]
17
+ if (sync) {
18
+ attrs.push({
19
+ type: "mdxJsxAttribute" as const,
20
+ name: "sync",
21
+ value: sync,
22
+ })
23
+ }
26
24
 
27
- const jsxNode = {
28
- type: "mdxJsxFlowElement" as const,
29
- name: "ContentTab",
30
- attributes: attrs,
31
- children: node.children,
32
- data: { _mdxExplicitJsx: true },
33
- }
25
+ const jsxNode = {
26
+ type: "mdxJsxFlowElement" as const,
27
+ name: "ContentTab",
28
+ attributes: attrs,
29
+ children: node.children,
30
+ data: { _mdxExplicitJsx: true },
31
+ }
34
32
 
35
- // @ts-expect-error mdxJsxFlowElement is not in mdast types
36
- parent.children[index] = jsxNode
37
- return SKIP
38
- },
39
- )
33
+ // @ts-expect-error mdxJsxFlowElement is not in mdast types
34
+ parent.children[index] = jsxNode
35
+ return SKIP
36
+ })
40
37
 
41
38
  const children = tree.children
42
39
  let i = 0
@@ -52,8 +49,7 @@ export function transformTabDirectives(tree: Root) {
52
49
  while (j < children.length) {
53
50
  const next = children[j]
54
51
  // @ts-expect-error mdxJsxFlowElement is not in mdast types
55
- if (next?.type !== "mdxJsxFlowElement" || next.name !== "ContentTab")
56
- break
52
+ if (next?.type !== "mdxJsxFlowElement" || next.name !== "ContentTab") break
57
53
  j++
58
54
  }
59
55
 
@@ -11,9 +11,7 @@ function makeContainerDirective(
11
11
  type: "containerDirective",
12
12
  name,
13
13
  attributes: attributes ?? {},
14
- children: [
15
- { type: "paragraph", children: [{ type: "text", value: "content" }] },
16
- ],
14
+ children: [{ type: "paragraph", children: [{ type: "text", value: "content" }] }],
17
15
  }
18
16
  }
19
17
 
@@ -39,9 +37,7 @@ describe("transformTabDirectives", () => {
39
37
  {
40
38
  type: "mdxJsxFlowElement",
41
39
  name: "ContentTab",
42
- attributes: [
43
- { type: "mdxJsxAttribute", name: "title", value: "React" },
44
- ],
40
+ attributes: [{ type: "mdxJsxAttribute", name: "title", value: "React" }],
45
41
  },
46
42
  ],
47
43
  })
@@ -37,9 +37,7 @@ describe("transformTocDirectives", () => {
37
37
  })
38
38
 
39
39
  it("should ignore unrelated leaf directives", () => {
40
- const tree = process(
41
- makeTree(makeLeafDirective("video", { type: "youtube" })),
42
- )
40
+ const tree = process(makeTree(makeLeafDirective("video", { type: "youtube" })))
43
41
  const node = tree.children[0]
44
42
  expect(node).toMatchObject({ type: "leafDirective", name: "video" })
45
43
  })
@@ -4,10 +4,7 @@ interface HastElement {
4
4
 
5
5
  interface ShikiTransformer {
6
6
  name: string
7
- pre: (
8
- this: { options: { lang?: string } },
9
- pre: HastElement,
10
- ) => HastElement | void
7
+ pre: (this: { options: { lang?: string } }, pre: HastElement) => HastElement | void
11
8
  }
12
9
 
13
10
  type Icon = { viewBox: string; fill: string; d: string }
@@ -11,10 +11,7 @@ interface HastElement {
11
11
 
12
12
  interface ShikiTransformer {
13
13
  name: string
14
- preprocess?: (
15
- this: { options: { meta?: { __raw?: string } } },
16
- code: string,
17
- ) => void
14
+ preprocess?: (this: { options: { meta?: { __raw?: string } } }, code: string) => void
18
15
  pre?: (pre: HastElement) => HastElement | void
19
16
  line?: (line: HastElement, lineNumber: number) => HastElement | void
20
17
  span?: (span: HastElement) => HastElement | void
@@ -67,8 +64,7 @@ function spanContainsWord(span: HastElement, word: string): boolean {
67
64
  return false
68
65
  }
69
66
 
70
- const NOTATION_RE =
71
- /\/\/\s*\[!code\s+(highlight|focus|\+\+|--|error|warning)\]\s*$/
67
+ const NOTATION_RE = /\/\/\s*\[!code\s+(highlight|focus|\+\+|--|error|warning)\]\s*$/
72
68
  const NOTATION_BLOCK_RE =
73
69
  /\/\*\s*\[!code\s+(highlight|focus|\+\+|--|error|warning)\]\s*\*\/\s*$/
74
70
 
@@ -79,8 +75,7 @@ function stripNotationFromLine(line: HastElement): string | undefined {
79
75
  if (result !== undefined) return result
80
76
  }
81
77
  if (child.type === "text") {
82
- const match =
83
- child.value.match(NOTATION_RE) ?? child.value.match(NOTATION_BLOCK_RE)
78
+ const match = child.value.match(NOTATION_RE) ?? child.value.match(NOTATION_BLOCK_RE)
84
79
  if (match) {
85
80
  child.value = child.value.slice(0, match.index).trimEnd()
86
81
  return match[1]!
@@ -158,9 +153,7 @@ export function transformerLineHighlight(): ShikiTransformer {
158
153
  line.properties["data-highlighted"] = ""
159
154
  }
160
155
  if (lineNumbers.enabled) {
161
- line.properties["data-line-number"] = String(
162
- lineNumber - 1 + lineNumbers.start,
163
- )
156
+ line.properties["data-line-number"] = String(lineNumber - 1 + lineNumbers.start)
164
157
  }
165
158
  return line
166
159
  },
@@ -1,12 +1,7 @@
1
1
  import { cpSync, existsSync, rmSync } from "node:fs"
2
2
  import { join, sep } from "node:path"
3
3
  import { watch as chokidarWatch } from "chokidar"
4
- import type {
5
- ConfigEnv,
6
- Plugin,
7
- UserConfig as ViteUserConfig,
8
- ViteDevServer,
9
- } from "vite"
4
+ import type { ConfigEnv, Plugin, UserConfig as ViteUserConfig, ViteDevServer } from "vite"
10
5
  import { mergeConfig } from "vite"
11
6
  import { buildTarget } from "../actions/target/build.ts"
12
7
  import type { Config } from "../models/config.ts"
@@ -181,13 +176,11 @@ function syncOverlay(
181
176
  const source = join(SOURCE_DIR, hit.rel)
182
177
  if (kind === "unlink") {
183
178
  rmSync(dest, { force: true, recursive: true })
184
- if (existsSync(source))
185
- cpSync(source, dest, { recursive: true, force: true })
179
+ if (existsSync(source)) cpSync(source, dest, { recursive: true, force: true })
186
180
  return
187
181
  }
188
182
  const overlay = join(overridesRoot, hit.rel)
189
- if (existsSync(overlay))
190
- cpSync(overlay, dest, { recursive: true, force: true })
183
+ if (existsSync(overlay)) cpSync(overlay, dest, { recursive: true, force: true })
191
184
  }
192
185
 
193
186
  function syncSource(
@@ -14,12 +14,7 @@ export interface RobotsOptions {
14
14
  * overlay wins — Vite copies the publicDir before writeBundle, so
15
15
  * unconditional emitFile would silently overwrite the override. */
16
16
  export function robots(opts: RobotsOptions): Plugin {
17
- const overrideFile = join(
18
- opts.config.root,
19
- ".livemark",
20
- "public",
21
- "robots.txt",
22
- )
17
+ const overrideFile = join(opts.config.root, ".livemark", "public", "robots.txt")
23
18
  return {
24
19
  name: "livemark:robots",
25
20
  applyToEnvironment(env) {
@@ -19,9 +19,7 @@ describe("renderRobots", () => {
19
19
  })
20
20
 
21
21
  it("includes the base path so the URL matches the build mount", () => {
22
- expect(
23
- renderRobots({ site: "https://user.github.io", base: "/repo" }),
24
- ).toBe(
22
+ expect(renderRobots({ site: "https://user.github.io", base: "/repo" })).toBe(
25
23
  "User-agent: *\nAllow: /\n\nSitemap: https://user.github.io/repo/sitemap.xml\n",
26
24
  )
27
25
  })
@@ -44,9 +44,7 @@ export const Route = createFileRoute("/$")({
44
44
  }
45
45
  }
46
46
 
47
- const tagMatch = splat.match(
48
- new RegExp(`^${section.prefix}tags/([^/]+)/$`),
49
- )
47
+ const tagMatch = splat.match(new RegExp(`^${section.prefix}tags/([^/]+)/$`))
50
48
  const tag = tagMatch?.[1]
51
49
  if (tag) {
52
50
  const tagMap = sectionTags.get(section.prefix)
@@ -140,11 +140,7 @@
140
140
  }
141
141
  [data-slot="sidebar-content"]:hover,
142
142
  [data-slot="sidebar-content"]:focus-within {
143
- scrollbar-color: color-mix(
144
- in oklch,
145
- var(--sidebar-foreground) 20%,
146
- transparent
147
- )
143
+ scrollbar-color: color-mix(in oklch, var(--sidebar-foreground) 20%, transparent)
148
144
  transparent;
149
145
  }
150
146