@alloy-js/markdown 0.15.0 → 0.16.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.
- package/CHANGELOG.md +8 -0
- package/dist/src/components/Code.d.ts +12 -0
- package/dist/src/components/Code.d.ts.map +1 -0
- package/dist/src/components/Code.js +13 -0
- package/dist/src/components/Frontmatter.d.ts +19 -0
- package/dist/src/components/Frontmatter.d.ts.map +1 -0
- package/dist/src/components/Frontmatter.js +25 -0
- package/dist/src/components/index.d.ts +7 -1
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +7 -0
- package/dist/test/Code.test.d.ts +2 -0
- package/dist/test/Code.test.d.ts.map +1 -0
- package/dist/test/Code.test.js +37 -0
- package/dist/test/Frontmatter.test.d.ts +2 -0
- package/dist/test/Frontmatter.test.d.ts.map +1 -0
- package/dist/test/Frontmatter.test.js +37 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -4
- package/src/components/Code.tsx +24 -0
- package/src/components/Frontmatter.tsx +32 -0
- package/src/components/index.ts +7 -0
- package/temp/api.json +1169 -1
- package/test/Code.test.tsx +37 -0
- package/test/Frontmatter.test.tsx +40 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { List } from "@alloy-js/core";
|
|
2
|
+
import "@alloy-js/core/testing";
|
|
3
|
+
import { d } from "@alloy-js/core/testing";
|
|
4
|
+
import { expect, it } from "vitest";
|
|
5
|
+
import { Code } from "../src/components/Code.jsx";
|
|
6
|
+
import { mdTest } from "./utils.jsx";
|
|
7
|
+
|
|
8
|
+
it("renders with js value", () => {
|
|
9
|
+
const template = mdTest(
|
|
10
|
+
<Code lang="ts" children={"const foo = 123;\nconsole.log(foo);"} />,
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
expect(template).toRenderTo(d`
|
|
14
|
+
\`\`\`ts
|
|
15
|
+
const foo = 123;
|
|
16
|
+
console.log(foo);
|
|
17
|
+
\`\`\`
|
|
18
|
+
`);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("renders with children", () => {
|
|
22
|
+
const template = mdTest(
|
|
23
|
+
<Code lang="ts">
|
|
24
|
+
<List>
|
|
25
|
+
<>const foo = 123;</>
|
|
26
|
+
<>console.log(foo);</>
|
|
27
|
+
</List>
|
|
28
|
+
</Code>,
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
expect(template).toRenderTo(d`
|
|
32
|
+
\`\`\`ts
|
|
33
|
+
const foo = 123;
|
|
34
|
+
console.log(foo);
|
|
35
|
+
\`\`\`
|
|
36
|
+
`);
|
|
37
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import "@alloy-js/core/testing";
|
|
2
|
+
import { d } from "@alloy-js/core/testing";
|
|
3
|
+
import { expect, it } from "vitest";
|
|
4
|
+
import { Frontmatter } from "../src/components/Frontmatter.jsx";
|
|
5
|
+
import { mdTest } from "./utils.jsx";
|
|
6
|
+
|
|
7
|
+
it("renders with js value", () => {
|
|
8
|
+
const template = mdTest(
|
|
9
|
+
<Frontmatter jsValue={{ title: "My Title", tags: ["tag1", "tag2"] }} />,
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
expect(template).toRenderTo(d`
|
|
13
|
+
---
|
|
14
|
+
title: My Title
|
|
15
|
+
tags:
|
|
16
|
+
- tag1
|
|
17
|
+
- tag2
|
|
18
|
+
---
|
|
19
|
+
`);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("renders with children", () => {
|
|
23
|
+
const template = mdTest(
|
|
24
|
+
<Frontmatter>
|
|
25
|
+
<>{`title: My Title`}</>
|
|
26
|
+
<>{`tags:`}</>
|
|
27
|
+
<>{` - tag1`}</>
|
|
28
|
+
<>{` - tag2`}</>
|
|
29
|
+
</Frontmatter>,
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
expect(template).toRenderTo(d`
|
|
33
|
+
---
|
|
34
|
+
title: My Title
|
|
35
|
+
tags:
|
|
36
|
+
- tag1
|
|
37
|
+
- tag2
|
|
38
|
+
---
|
|
39
|
+
`);
|
|
40
|
+
});
|