Skip to content

Commit

Permalink
render examples in a <code> block (#256)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris48s committed Jul 24, 2023
1 parent 0ebd2b9 commit 8b65a43
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,21 @@ export function createParamsTable({ parameters, type }: Props) {
guard(param.example, (example) =>
create("div", {
style: { marginTop: "var(--ifm-table-cell-padding)" },
children: escape(`Example: ${example}`),
children: [
"Example: ",
create("code", { children: escape(example) }),
],
})
),
guard(param.examples, (examples) =>
create("div", {
style: { marginTop: "var(--ifm-table-cell-padding)" },
children: Object.entries(examples).map(([k, v]) =>
create("div", {
children: escape(`Example (${k}): ${v.value}`),
children: [
`Example (${k}): `,
create("code", { children: escape(v.value) }),
],
})
),
})
Expand Down

0 comments on commit 8b65a43

Please sign in to comment.