@microsoft/api-documenter
Advanced tools
Comparing version 7.23.38 to 7.24.0
@@ -56,3 +56,2 @@ "use strict"; | ||
writer.ensureSkippedLine(); | ||
context.insideTable = true; | ||
// Markdown table rows can have inconsistent cell counts. Size the table based on the longest row. | ||
@@ -68,7 +67,9 @@ let columnCount = 0; | ||
} | ||
// write the table header (which is required by Markdown) | ||
writer.write('| '); | ||
for (let i = 0; i < columnCount; ++i) { | ||
writer.write(' '); | ||
if (docTable.header) { | ||
writer.write('<table>'); | ||
if (docTable.header) { | ||
writer.write('<thead><tr>'); | ||
for (let i = 0; i < columnCount; ++i) { | ||
writer.write('<th>'); | ||
writer.ensureNewLine(); | ||
writer.writeLine(); | ||
const cell = docTable.header.cells[i]; | ||
@@ -78,23 +79,27 @@ if (cell) { | ||
} | ||
writer.ensureNewLine(); | ||
writer.writeLine(); | ||
writer.write('</th>'); | ||
} | ||
writer.write(' |'); | ||
writer.write('</tr></thead>'); | ||
} | ||
writer.writeLine(); | ||
// write the divider | ||
writer.write('| '); | ||
for (let i = 0; i < columnCount; ++i) { | ||
writer.write(' --- |'); | ||
} | ||
writer.writeLine(); | ||
writer.write('<tbody>'); | ||
for (const row of docTable.rows) { | ||
writer.write('| '); | ||
writer.write('<tr>'); | ||
for (const cell of row.cells) { | ||
writer.write(' '); | ||
writer.write('<td>'); | ||
writer.ensureNewLine(); | ||
writer.writeLine(); | ||
this.writeNode(cell.content, context, false); | ||
writer.write(' |'); | ||
writer.ensureNewLine(); | ||
writer.writeLine(); | ||
writer.write('</td>'); | ||
} | ||
writer.write('</tr>'); | ||
writer.writeLine(); | ||
} | ||
writer.write('</tbody>'); | ||
writer.write('</table>'); | ||
writer.writeLine(); | ||
context.insideTable = false; | ||
break; | ||
@@ -101,0 +106,0 @@ } |
@@ -7,3 +7,2 @@ import { type DocNode, type StringBuilder, type DocLinkTag } from '@microsoft/tsdoc'; | ||
writer: IndentedWriter; | ||
insideTable: boolean; | ||
boldRequested: boolean; | ||
@@ -10,0 +9,0 @@ italicRequested: boolean; |
@@ -18,3 +18,2 @@ "use strict"; | ||
writer, | ||
insideTable: false, | ||
boldRequested: false, | ||
@@ -68,22 +67,5 @@ italicRequested: false, | ||
const docCodeSpan = docNode; | ||
if (context.insideTable) { | ||
writer.write('<code>'); | ||
} | ||
else { | ||
writer.write('`'); | ||
} | ||
if (context.insideTable) { | ||
const code = this.getTableEscapedText(docCodeSpan.code); | ||
const parts = code.split(/\r?\n/g); | ||
writer.write(parts.join('</code><br/><code>')); | ||
} | ||
else { | ||
writer.write(docCodeSpan.code); | ||
} | ||
if (context.insideTable) { | ||
writer.write('</code>'); | ||
} | ||
else { | ||
writer.write('`'); | ||
} | ||
writer.write('`'); | ||
writer.write(docCodeSpan.code); | ||
writer.write('`'); | ||
break; | ||
@@ -107,22 +89,5 @@ } | ||
const trimmedParagraph = tsdoc_1.DocNodeTransforms.trimSpacesInParagraph(docParagraph); | ||
if (context.insideTable) { | ||
if (docNodeSiblings) { | ||
// This tentative write is necessary to avoid writing empty paragraph tags (i.e. `<p></p>`). At the | ||
// time this code runs, we do not know whether the `writeNodes` call below will actually write | ||
// anything. Thus, we want to only write a `<p>` tag (as well as eventually a corresponding | ||
// `</p>` tag) if something ends up being written within the tags. | ||
writer.writeTentative('<p>', '</p>', () => { | ||
this.writeNodes(trimmedParagraph.nodes, context); | ||
}); | ||
} | ||
else { | ||
// Special case: If we are the only element inside this table cell, then we can omit the <p></p> container. | ||
this.writeNodes(trimmedParagraph.nodes, context); | ||
} | ||
} | ||
else { | ||
this.writeNodes(trimmedParagraph.nodes, context); | ||
writer.ensureNewLine(); | ||
writer.writeLine(); | ||
} | ||
this.writeNodes(trimmedParagraph.nodes, context); | ||
writer.ensureNewLine(); | ||
writer.writeLine(); | ||
break; | ||
@@ -129,0 +94,0 @@ } |
{ | ||
"name": "@microsoft/api-documenter", | ||
"version": "7.23.38", | ||
"version": "7.24.0", | ||
"description": "Read JSON files from api-extractor, generate documentation pages", | ||
@@ -21,6 +21,6 @@ "repository": { | ||
"resolve": "~1.22.1", | ||
"@rushstack/node-core-library": "4.0.2", | ||
"@microsoft/api-extractor-model": "7.28.13", | ||
"@rushstack/node-core-library": "4.0.2", | ||
"@rushstack/terminal": "0.10.0", | ||
"@rushstack/ts-command-line": "4.19.1" | ||
"@rushstack/ts-command-line": "4.19.1", | ||
"@rushstack/terminal": "0.10.0" | ||
}, | ||
@@ -30,4 +30,4 @@ "devDependencies": { | ||
"@types/resolve": "1.20.2", | ||
"local-node-rig": "1.0.0", | ||
"@rushstack/heft": "0.66.1" | ||
"@rushstack/heft": "0.66.1", | ||
"local-node-rig": "1.0.0" | ||
}, | ||
@@ -34,0 +34,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
613089
6617