Compare commits
2 Commits
f4e5f96f49
...
ed6451da79
| Author | SHA1 | Date | |
|---|---|---|---|
| ed6451da79 | |||
| d756f7f66e |
@ -1,9 +1,9 @@
|
|||||||
import type { Config, Node } from "@markdoc/markdoc";
|
import type { Config, Node } from "@markdoc/markdoc";
|
||||||
|
|
||||||
import { slugifyWithCounter } from "@sindresorhus/slugify";
|
import { slugifyWithCounter } from "@sindresorhus/slugify";
|
||||||
import { nodes as defaultNodes } from "@markdoc/markdoc";
|
|
||||||
import { DocsLayout } from "@syntax/DocsLayout";
|
import { DocsLayout } from "@syntax/DocsLayout";
|
||||||
import { Link } from "@/components/common/Link";
|
import { Link } from "@/components/common/Link";
|
||||||
|
import Markdoc from "@markdoc/markdoc";
|
||||||
import { Fence } from "@syntax/Fence";
|
import { Fence } from "@syntax/Fence";
|
||||||
import { Tag } from "./Tag";
|
import { Tag } from "./Tag";
|
||||||
import yaml from "js-yaml";
|
import yaml from "js-yaml";
|
||||||
@ -12,7 +12,7 @@ const documentSlugifyMap = new Map();
|
|||||||
|
|
||||||
const nodes = {
|
const nodes = {
|
||||||
document: {
|
document: {
|
||||||
...defaultNodes.document,
|
...Markdoc.nodes.document,
|
||||||
render: DocsLayout,
|
render: DocsLayout,
|
||||||
transform(node: Node, config: Config) {
|
transform(node: Node, config: Config) {
|
||||||
documentSlugifyMap.set(config, slugifyWithCounter());
|
documentSlugifyMap.set(config, slugifyWithCounter());
|
||||||
@ -29,7 +29,7 @@ const nodes = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
heading: {
|
heading: {
|
||||||
...defaultNodes.heading,
|
...Markdoc.nodes.heading,
|
||||||
transform(node: Node, config: Config) {
|
transform(node: Node, config: Config) {
|
||||||
const slugify = documentSlugifyMap.get(config);
|
const slugify = documentSlugifyMap.get(config);
|
||||||
const attributes = node.transformAttributes(config);
|
const attributes = node.transformAttributes(config);
|
||||||
@ -41,9 +41,9 @@ const nodes = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
strong: {
|
strong: {
|
||||||
...defaultNodes.strong,
|
...Markdoc.nodes.strong,
|
||||||
attributes: {
|
attributes: {
|
||||||
...defaultNodes.strong.attributes,
|
...Markdoc.nodes.strong.attributes,
|
||||||
class: {
|
class: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "font-semibold text-slate-800 dark:text-slate-200",
|
default: "font-semibold text-slate-800 dark:text-slate-200",
|
||||||
@ -51,9 +51,9 @@ const nodes = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
table: {
|
table: {
|
||||||
...defaultNodes.table,
|
...Markdoc.nodes.table,
|
||||||
attributes: {
|
attributes: {
|
||||||
...defaultNodes.table.attributes,
|
...Markdoc.nodes.table.attributes,
|
||||||
class: {
|
class: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "block max-w-full overflow-x-auto border-collapse text-sm",
|
default: "block max-w-full overflow-x-auto border-collapse text-sm",
|
||||||
@ -61,9 +61,9 @@ const nodes = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
th: {
|
th: {
|
||||||
...defaultNodes.th,
|
...Markdoc.nodes.th,
|
||||||
attributes: {
|
attributes: {
|
||||||
...defaultNodes.th.attributes,
|
...Markdoc.nodes.th.attributes,
|
||||||
scope: {
|
scope: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "col",
|
default: "col",
|
||||||
@ -79,7 +79,7 @@ const nodes = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
link: {
|
link: {
|
||||||
...defaultNodes.link,
|
...Markdoc.nodes.link,
|
||||||
render: Link,
|
render: Link,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user