spec-up-t 1.6.0-beta.8 → 1.6.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-up-t",
3
- "version": "1.6.0-beta.8",
3
+ "version": "1.6.0",
4
4
  "description": "Technical specification drafting tool that generates rich specification documents from markdown. Forked from https://github.com/decentralized-identity/spec-up by Daniel Buchner (https://github.com/csuwildcat)",
5
5
  "main": "./index",
6
6
  "repository": {
@@ -86,8 +86,50 @@ async function render(spec, assets, sharedVars, config, template, assetsGlobal,
86
86
 
87
87
  md[spec.katex ? "enable" : "disable"](['math_block', 'math_inline']);
88
88
 
89
- // `render` is the rendered HTML
90
- let renderedHtml = md.render(doc);
89
+ // Suppress markdown-it-attrs table errors during rendering
90
+ //
91
+ // Background: markdown-it-attrs can throw "Cannot read properties of null (reading 'colsnum')"
92
+ // errors when processing malformed tables. These errors are:
93
+ // 1. Non-blocking: The rendering continues and index.html is generated successfully
94
+ // 2. Caught proactively: The markdown-tables healthcheck detects these issues
95
+ // 3. Noisy: They clutter the console output without providing actionable information
96
+ //
97
+ // Solution: Intercept console.error during md.render() to suppress only these specific
98
+ // table-related errors while allowing all other errors to pass through normally.
99
+ const originalConsoleError = console.error;
100
+ let suppressNext = false;
101
+ console.error = (...args) => {
102
+ const message = args[0]?.toString() || '';
103
+
104
+ // Check if this is the first console.error call with the error message
105
+ if (message.includes('markdown-it-attrs: Error in pattern') &&
106
+ message.includes('tables') &&
107
+ message.includes('colsnum')) {
108
+ // Suppress this error and the next stack trace
109
+ suppressNext = true;
110
+ return;
111
+ }
112
+
113
+ // Check if this is the stack trace following the suppressed error
114
+ if (suppressNext) {
115
+ suppressNext = false;
116
+ // Also suppress if this looks like a stack trace for colsnum error
117
+ if (message.includes('colsnum') || message.includes('at Object.transform')) {
118
+ return;
119
+ }
120
+ }
121
+
122
+ // Let all other errors through
123
+ originalConsoleError.apply(console, args);
124
+ };
125
+
126
+ try {
127
+ // `render` is the rendered HTML
128
+ renderedHtml = md.render(doc);
129
+ } finally {
130
+ // Always restore console.error
131
+ console.error = originalConsoleError;
132
+ }
91
133
 
92
134
  // Apply the fix for broken definition list structures
93
135
  renderedHtml = fixDefinitionListStructure(renderedHtml);