diff --git a/client/homebrew/editor/snippetbar/snippets/classtable.gen.js b/client/homebrew/editor/snippetbar/snippets/classtable.gen.js
index 867aa625e..c8a2d051f 100644
--- a/client/homebrew/editor/snippetbar/snippets/classtable.gen.js
+++ b/client/homebrew/editor/snippetbar/snippets/classtable.gen.js
@@ -70,9 +70,10 @@ module.exports = {
let cantrips = 3;
let spells = 1;
let slots = 2;
- return `
\n##### The ${classname}\n` +
- `| Level | Proficiency Bonus | Features | Cantrips Known | Spells Known | 1st | 2nd | 3rd | 4th | 5th | 6th | 7th | 8th | 9th |\n`+
- `|:---:|:---:|:---|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|\n${
+ return `{{classTable,wide\n##### The ${classname}\n` +
+ `| Level | Proficiency | Features | Cantrips | Spells | --- Spell Slots Per Level --- |||||||||\n`+
+ `| ^| Bonus ^| ^| Known ^| Known ^| 1st | 2nd | 3rd | 4th | 5th | 6th | 7th | 8th | 9th |\n`+
+ `|:-----:|:-----------:|:---------|:--------:|:------:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|\n${
_.map(levels, function(levelName, level){
const res = [
levelName,
@@ -88,7 +89,7 @@ module.exports = {
slots += _.random(0, 2);
return `| ${res} |`;
- }).join('\n')}\n
\n\n`;
+ }).join('\n')}\n}}\n\n`;
},
half : function(){
diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js
index 3a341f379..2a6f0e3b9 100644
--- a/shared/naturalcrit/markdown.js
+++ b/shared/naturalcrit/markdown.js
@@ -287,13 +287,13 @@ const spanTable = {
// Get any remaining header rows
l = item.header.length;
for (i = 1; i < l; i++) {
- item.header[i] = splitCells(item.header[i], colCount);
+ item.header[i] = splitCells(item.header[i], colCount, item.header[i-1]);
}
// Get main table cells
l = item.rows.length;
for (i = 0; i < l; i++) {
- item.rows[i] = splitCells(item.rows[i], colCount);
+ item.rows[i] = splitCells(item.rows[i], colCount, item.rows[i-1]);
}
// header child tokens
@@ -330,7 +330,7 @@ const spanTable = {
for (j = 0; j < row.length; j++) {
cell = row[j];
text = this.parseInline(cell.tokens);
- output += getTableCell(text, cell.colspan, 'th', token.align[col]);
+ output += getTableCell(text, cell, 'th', token.align[col]);
col += cell.colspan;
}
output += ``;
@@ -345,7 +345,7 @@ const spanTable = {
for (j = 0; j < row.length; j++) {
cell = row[j];
text = this.parseInline(cell.tokens);
- output += getTableCell(text, cell.colspan, 'td', token.align[col]);
+ output += getTableCell(text, cell, 'td', token.align[col]);
col += cell.colspan;
}
output += ``;
@@ -357,14 +357,18 @@ const spanTable = {
}
};
-const getTableCell = (text, colspan, type, align)=>{
+const getTableCell = (text, cell, type, align)=>{
+ if(!cell.rowspan) {
+ return '';
+ }
const tag = `<${type}`
- + `${colspan > 1 ? ` colspan=${colspan}` : ''}`
+ + `${cell.colspan > 1 ? ` colspan=${cell.colspan}` : ''}`
+ + `${cell.rowspan > 1 ? ` rowspan=${cell.rowspan}` : ''}`
+ `${align ? ` align=${align}` : ''}>`;
return `${tag + text}${type}>\n`;
};
-const splitCells = (tableRow, count)=>{
+const splitCells = (tableRow, count, prevRow = [])=>{
// ensure that every cell-delimiting pipe has a space
// before it to distinguish it from an escaped pipe
const row = tableRow.replace(/(\|+)/g, (match, p1, offset, str)=>{
@@ -391,12 +395,34 @@ const splitCells = (tableRow, count)=>{
let numCols = 0;
for (; i < cells.length; i++) {
- const trimmedCell = cells[i].split(/(? numCols)
+ break;
+ }
+ }
+
numCols += cells[i].colspan;
}