Skip to content

Commit 84454c9

Browse files
committed
feat: update formatter to new output
1 parent 4e6329e commit 84454c9

File tree

5 files changed

+31
-29
lines changed

5 files changed

+31
-29
lines changed

src/format/fixtures/api-docs-html.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/format/headings.ts

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -128,30 +128,32 @@ export function linkify_headings(): Transformer {
128128
const children = (to_hast(node) as Parent).children;
129129

130130
if (!node.data) node.data = {};
131-
if (!node.data.hProperties) node.data.hProperties = {};
132-
if (!node.data.hChildren) node.data.hChildren = [];
133-
134-
const span_node = {
135-
type: "element",
136-
tagName: "span",
137-
properties: { id: [slug], className: ["offset-anchor"] },
138-
};
139-
140-
const a_node = {
141-
type: "element",
142-
tagName: "a",
143-
properties: {
144-
href: `${data.dir}#${slug}`,
145-
className: ["anchor"],
146-
"aria-hidden": true,
147-
},
131+
if (!node.data.hProperties) node.data.hProperties = {
132+
id: slug
148133
};
134+
if (!node.data.hChildren) node.data.hChildren = [];
149135

150-
if (node.depth > data.base_level + 1)
151-
//@ts-ignore
152-
span_node.properties["data-scrollignore"] = true;
153-
154-
node.data.hChildren = [span_node, a_node];
136+
// const span_node = {
137+
// type: "element",
138+
// tagName: "span",
139+
// properties: { id: [slug], className: ["offset-anchor"] },
140+
// };
141+
142+
// const a_node = {
143+
// type: "element",
144+
// tagName: "a",
145+
// properties: {
146+
// href: `${data.dir}#${slug}`,
147+
// className: ["anchor"],
148+
// "aria-hidden": true,
149+
// },
150+
// };
151+
152+
// if (node.depth > data.base_level + 1)
153+
// //@ts-ignore
154+
// span_node.properties["data-scrollignore"] = true;
155+
156+
// node.data.hChildren = [span_node, a_node];
155157

156158
children.forEach((v) => node.data.hChildren.push(v));
157159
});

src/fs/fixtures/output-repo-1.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/transform/fixtures/blog.ts

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

src/transform/fixtures/docs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export const docs_readme_full_out: Doc[] = [
6060
},
6161
],
6262
content:
63-
'<p>asdasdas</p>\n<h3><span id="hello" class="offset-anchor"></span><a href="http://github.com/docs/adapter-vercel#hello" class="anchor" aria-hidden rel="noopener noreferrer"></a>hello</h3>\n<p>asdasd</p>\n<h4><span id="hello-third-heading" class="offset-anchor"></span><a href="http://github.com/docs/adapter-vercel#hello-third-heading" class="anchor" aria-hidden rel="noopener noreferrer"></a>Third heading</h4>\n<p>asdasdasd</p>',
63+
'<p>asdasdas</p>\n<h3 id="hello">hello</h3>\n<p>asdasd</p>\n<h4><span id="hello-third-heading" class="offset-anchor"></span><a href="http://github.com/docs/adapter-vercel#hello-third-heading" class="anchor" aria-hidden rel="noopener noreferrer"></a>Third heading</h4>\n<p>asdasdasd</p>',
6464
},
6565
];
6666

0 commit comments

Comments
 (0)