markdown-it-adv-table 0.2.1 → 0.2.2

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.
@@ -13,7 +13,7 @@ export class TableBuilder {
13
13
  return new TableBuilder(new state.md.block.State("", state.md, state.env, []), tableSpec);
14
14
  }
15
15
  get useColgroup() {
16
- return this.tableSpec.attr.cols?.startsWith("\"");
16
+ return this.tableSpec.colspecs.finemode;
17
17
  }
18
18
  get useTHead() {
19
19
  return this.tableSpec.headerRows > 0;
@@ -64,9 +64,6 @@ export class TableBuilder {
64
64
  if (this.useTHead && row === 0) {
65
65
  this.startTHead();
66
66
  }
67
- else if (this.useTBody && row === this.tableSpec.headerRows) {
68
- this.startTBody();
69
- }
70
67
  this.startRow();
71
68
  }
72
69
  const token = this.state.push(`${tx}_open`, tx, 1);
@@ -85,6 +82,7 @@ export class TableBuilder {
85
82
  this.endRow();
86
83
  if (this.useTHead && row == this.tableSpec.headerRows - 1) {
87
84
  this.endTHead();
85
+ this.startTBody();
88
86
  }
89
87
  }
90
88
  }
package/lib/table.d.ts CHANGED
@@ -37,6 +37,7 @@ export declare class TableSpec {
37
37
  export declare class ColSpecs {
38
38
  readonly numCols: number;
39
39
  readonly specs: readonly ColumnAttr[];
40
+ readonly finemode: boolean;
40
41
  constructor(colspec: string);
41
42
  colSpec(col: number): ColumnAttr;
42
43
  colWidth(col: number): ColWidth;
package/lib/table.js CHANGED
@@ -92,7 +92,7 @@ export class TableSpec {
92
92
  const key = consume();
93
93
  consume("=");
94
94
  const value = consume();
95
- result[key] = value;
95
+ result[key] = unwrapLiteral(value, "\"");
96
96
  }
97
97
  else {
98
98
  consume();
@@ -124,11 +124,13 @@ export class TableSpec {
124
124
  export class ColSpecs {
125
125
  numCols;
126
126
  specs;
127
+ finemode = false;
127
128
  constructor(colspec) {
128
129
  if (colspec.startsWith("\"") || colspec.includes(",")) {
129
130
  const specs = unwrapLiteral(colspec, "\"").split(",");
130
131
  this.numCols = Math.max(1, specs.length);
131
132
  this.specs = specs.map(ColSpecs.parseColSpec);
133
+ this.finemode = true;
132
134
  }
133
135
  else if (/^\d+/.test(colspec)) {
134
136
  this.numCols = Math.max(1, parseInt(colspec, 10));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markdown-it-adv-table",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Markdown syntax extension for better table support",
5
5
  "keywords": [
6
6
  "markdown",