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
|
@ -4,6 +4,8 @@ const toMdLink = (text) => `[${text}](#${toLink(text)})`;
|
|||
|
||||
const formatType = (type) => `<code>${type.replace(/\|/g, "|")}</code>`;
|
||||
|
||||
const escapeHtml = (text) => text.replace(/\</g, "<").replace(/\>/g, ">");
|
||||
|
||||
const HEADER_PROPS =
|
||||
"| Prop name | Type | Default value | Description |\n| :- | :- | :- | :- |\n";
|
||||
|
||||
|
@ -64,8 +66,8 @@ export function generateIndex(components, groups, pkg) {
|
|||
code += `| ${name}${
|
||||
prop.kind === "const" ? " (`constant`)" : ""
|
||||
} | ${formatType(prop.type)} | ${
|
||||
prop.value || "--"
|
||||
} | ${prop.description.replace(/\n/g, ". ")} |\n`;
|
||||
prop.value ? "`" + prop.value + "`" : "--"
|
||||
} | ${escapeHtml(prop.description).replace(/\n/g, ". ")}. |\n`;
|
||||
});
|
||||
} else {
|
||||
code += "No exported props.\n\n";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue