Skip to content

Commit 09f5028

Browse files
authored
Merge pull request #164 from docsbydoxdox/hotfix/bootstrap-markdown-types
[hotfix] Render types with markdown renderer.
2 parents c156e20 + 70967f1 commit 09f5028

File tree

3 files changed

+34
-13
lines changed

3 files changed

+34
-13
lines changed

packages/doxdox-renderer-bootstrap/src/index.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const md = new MarkdownIt({
1515
}</div>`
1616
});
1717

18+
const mdTypes = new MarkdownIt();
19+
1820
const renderMethod = (method: Method) => `<div class="mb-5" data-method-name="${
1921
method.name
2022
}"><a name="${method.slug}" />
@@ -36,14 +38,19 @@ ${
3638
<div class="table-responsive">
3739
${md
3840
.render(
39-
markdownTable([
40-
['Name', 'Types', 'Description'],
41-
...method.params.map(({ name, types, description }) => [
42-
name,
43-
`<code>${types.join('</code>, <code>')}</code>`,
44-
description || ''
45-
])
46-
])
41+
markdownTable(
42+
[
43+
['Name', 'Types', 'Description'],
44+
...method.params.map(({ name, types, description }) => [
45+
name,
46+
`<code>${types
47+
.map(type => mdTypes.renderInline(type))
48+
.join('</code>, <code>')}</code>`,
49+
description || ''
50+
])
51+
],
52+
{}
53+
)
4754
)
4855
.replace('<table>', '<table class="table">')}
4956
</div>`
@@ -55,7 +62,9 @@ ${
5562
? `<h3>Returns</h3>
5663
5764
${method.returns.map(
58-
param => `<p><code>${param.types.join('</code>, <code>')}</code></p>
65+
param => `<p><code>${param.types
66+
.map(type => mdTypes.renderInline(type))
67+
.join('</code>, <code>')}</code></p>
5968
6069
${param.description ? `<p>${param.description}</p>` : ''}`
6170
)}`

packages/doxdox-renderer-dash/src/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ const md = new MarkdownIt({
2525
}</div>`
2626
});
2727

28+
const mdTypes = new MarkdownIt();
29+
2830
const renderMethod = (doc: Doc, method: Method) => `<!DOCTYPE html>
2931
<html>
3032
<head>
@@ -63,7 +65,9 @@ ${md
6365
['Name', 'Types', 'Description'],
6466
...method.params.map(({ name, types, description }) => [
6567
name,
66-
`<code>${types.join('</code>, <code>')}</code>`,
68+
`<code>${types
69+
.map(type => mdTypes.renderInline(type))
70+
.join('</code>, <code>')}</code>`,
6771
description || ''
6872
])
6973
])
@@ -78,7 +82,9 @@ ${
7882
? `<h3>Returns</h3>
7983
8084
${method.returns.map(
81-
param => `<p><code>${param.types.join('</code>, <code>')}</code></p>
85+
param => `<p><code>${param.types
86+
.map(type => mdTypes.renderInline(type))
87+
.join('</code>, <code>')}</code></p>
8288
8389
${param.description ? `<p>${param.description}</p>` : ''}`
8490
)}`

packages/doxdox-renderer-pdf/src/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ const md = new MarkdownIt({
1717
}</div>`
1818
});
1919

20+
const mdTypes = new MarkdownIt();
21+
2022
const renderMethod = (method: Method) => `<div class="mb-5"><a name="${
2123
method.slug
2224
}" />
@@ -37,7 +39,9 @@ ${md
3739
['Name', 'Types', 'Description'],
3840
...method.params.map(({ name, types, description }) => [
3941
name,
40-
`<code>${types.join('</code>, <code>')}</code>`,
42+
`<code>${types
43+
.map(type => mdTypes.renderInline(type))
44+
.join('</code>, <code>')}</code>`,
4145
description || ''
4246
])
4347
])
@@ -52,7 +56,9 @@ ${
5256
? `<h3>Returns</h3>
5357
5458
${method.returns.map(
55-
param => `<p><code>${param.types.join('</code>, <code>')}</code></p>
59+
param => `<p><code>${param.types
60+
.map(type => mdTypes.renderInline(type))
61+
.join('</code>, <code>')}</code></p>
5662
5763
${param.description ? `<p>${param.description}</p>` : ''}`
5864
)}`

0 commit comments

Comments
 (0)