mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
docs(component-index): escape description
This commit is contained in:
parent
af8e3b1631
commit
0472c1ad23
2 changed files with 1014 additions and 1012 deletions
2020
COMPONENT_INDEX.md
2020
COMPONENT_INDEX.md
File diff suppressed because it is too large
Load diff
|
@ -4,6 +4,8 @@ const toMdLink = (text) => `[${text}](#${toLink(text)})`;
|
||||||
|
|
||||||
const formatType = (type) => `<code>${type.replace(/\|/g, "|")}</code>`;
|
const formatType = (type) => `<code>${type.replace(/\|/g, "|")}</code>`;
|
||||||
|
|
||||||
|
const escapeHtml = (text) => text.replace(/\</g, "<").replace(/\>/g, ">");
|
||||||
|
|
||||||
const HEADER_PROPS =
|
const HEADER_PROPS =
|
||||||
"| Prop name | Type | Default value | Description |\n| :- | :- | :- | :- |\n";
|
"| Prop name | Type | Default value | Description |\n| :- | :- | :- | :- |\n";
|
||||||
|
|
||||||
|
@ -64,8 +66,8 @@ export function generateIndex(components, groups, pkg) {
|
||||||
code += `| ${name}${
|
code += `| ${name}${
|
||||||
prop.kind === "const" ? " (`constant`)" : ""
|
prop.kind === "const" ? " (`constant`)" : ""
|
||||||
} | ${formatType(prop.type)} | ${
|
} | ${formatType(prop.type)} | ${
|
||||||
prop.value || "--"
|
prop.value ? "`" + prop.value + "`" : "--"
|
||||||
} | ${prop.description.replace(/\n/g, ". ")} |\n`;
|
} | ${escapeHtml(prop.description).replace(/\n/g, ". ")}. |\n`;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
code += "No exported props.\n\n";
|
code += "No exported props.\n\n";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue