@podlite/schema 0.0.64 → 0.0.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.podlite +20 -0
- package/esm/blocks-helpers.d.ts +1 -1
- package/esm/blocks-helpers.js +2 -1
- package/esm/blocks-helpers.js.map +1 -1
- package/esm/exportMarkdown.js +43 -9
- package/esm/exportMarkdown.js.map +1 -1
- package/esm/grammarfc.js +7794 -6355
- package/esm/grammarfc.js.map +1 -1
- package/esm/plugin-data-table.d.ts +1 -1
- package/esm/plugin-data-table.js +11 -10
- package/esm/plugin-data-table.js.map +1 -1
- package/esm/plugin-formatting-codes.js +49 -13
- package/esm/plugin-formatting-codes.js.map +1 -1
- package/esm/plugin-tables.d.ts +4 -2
- package/esm/plugin-tables.js +64 -18
- package/esm/plugin-tables.js.map +1 -1
- package/esm/types.d.ts +3 -2
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/lib/blocks-helpers.d.ts +1 -1
- package/lib/blocks-helpers.js +2 -1
- package/lib/exportMarkdown.js +43 -9
- package/lib/grammarfc.js +7794 -6355
- package/lib/plugin-data-table.d.ts +1 -1
- package/lib/plugin-data-table.js +10 -9
- package/lib/plugin-formatting-codes.js +49 -13
- package/lib/plugin-tables.d.ts +4 -2
- package/lib/plugin-tables.js +65 -18
- package/lib/types.d.ts +3 -2
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/schema/AstTree.json +8 -1
- package/schema/PodliteDocument.json +8 -1
package/lib/exportMarkdown.js
CHANGED
|
@@ -383,21 +383,55 @@ const rules = {
|
|
|
383
383
|
writer.writeRaw('</table>\n');
|
|
384
384
|
return;
|
|
385
385
|
}
|
|
386
|
+
// A cell holds a paragraph when the table is written as blocks, and a
|
|
387
|
+
// paragraph prints line breaks that would tear the row apart. The cell is
|
|
388
|
+
// rendered aside and folded onto one line.
|
|
389
|
+
const renderCell = cell => {
|
|
390
|
+
const parts = [];
|
|
391
|
+
const original = writer.output;
|
|
392
|
+
if (typeof original !== 'function')
|
|
393
|
+
return null;
|
|
394
|
+
writer.output = (str) => parts.push(str);
|
|
395
|
+
try {
|
|
396
|
+
;
|
|
397
|
+
(cell.content || []).forEach(c => {
|
|
398
|
+
if (typeof c === 'string') {
|
|
399
|
+
writer.write(c.trim());
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
interator([c], ctx);
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
finally {
|
|
407
|
+
writer.output = original;
|
|
408
|
+
}
|
|
409
|
+
return parts
|
|
410
|
+
.join('')
|
|
411
|
+
.replace(/\s*\n+\s*/g, ' ')
|
|
412
|
+
.trim();
|
|
413
|
+
};
|
|
386
414
|
// render each row
|
|
387
415
|
rows.forEach((row, rowIndex) => {
|
|
388
416
|
const cells = (row.content || []).filter(c => c.name === 'cell');
|
|
389
417
|
writer.writeRaw('|');
|
|
390
418
|
cells.forEach(cell => {
|
|
391
419
|
writer.writeRaw(' ');
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
420
|
+
const folded = renderCell(cell);
|
|
421
|
+
if (folded === null) {
|
|
422
|
+
if (cell.content) {
|
|
423
|
+
cell.content.forEach(c => {
|
|
424
|
+
if (typeof c === 'string') {
|
|
425
|
+
writer.write(c.trim());
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
interator([c], ctx);
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
writer.writeRaw(folded);
|
|
401
435
|
}
|
|
402
436
|
writer.writeRaw(' |');
|
|
403
437
|
});
|