@glossarist/concept-browser 0.7.8 → 0.7.9

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": "@glossarist/concept-browser",
3
- "version": "0.7.8",
3
+ "version": "0.7.9",
4
4
  "description": "Vue SPA for browsing Glossarist terminology datasets with cross-reference resolution, graph visualization, and multi-language support",
5
5
  "type": "module",
6
6
  "bin": {
@@ -33,6 +33,15 @@ describe('renderMath', () => {
33
33
  expect(result).toContain('<li>second item</li>');
34
34
  });
35
35
 
36
+ it('converts AsciiDoc pipe-delimited tables to <table>', () => {
37
+ const input = 'Intro text\n\n|===\n| a | b | c\n| d | e | f\n|===';
38
+ const result = renderMath(input);
39
+ expect(result).toContain('<table class="concept-table">');
40
+ expect(result).toContain('<tr><td>a</td><td>b</td><td>c</td></tr>');
41
+ expect(result).toContain('<tr><td>d</td><td>e</td><td>f</td></tr>');
42
+ expect(result).not.toContain('|===');
43
+ });
44
+
36
45
  it('resolves URN inline refs via xrefResolver', () => {
37
46
  const resolver = (uri: string, term: string) => `[${term}→${uri}]`;
38
47
  const result = renderMath(
package/src/style.css CHANGED
@@ -146,6 +146,19 @@
146
146
  margin: 0.25rem 0;
147
147
  }
148
148
 
149
+ .concept-table {
150
+ border-collapse: collapse;
151
+ margin: 0.75rem 0;
152
+ font-size: 0.875rem;
153
+ width: 100%;
154
+ }
155
+ .concept-table td {
156
+ border: 1px solid var(--ink-200, #d1d5db);
157
+ padding: 0.375rem 0.625rem;
158
+ vertical-align: top;
159
+ text-align: left;
160
+ }
161
+
149
162
  /* Smooth collapse for language sections */
150
163
  .lang-content {
151
164
  overflow: hidden;
package/src/utils/math.ts CHANGED
@@ -54,7 +54,20 @@ function mathPlaceholder(expr: string, format: string, bold: boolean): string {
54
54
  }
55
55
 
56
56
  function convertLists(text: string): string {
57
- let result = text.replace(/(?:^|\n)((?:[ \t]*\* [^\n]+)(?:\n[ \t]*\* [^\n]+)*)/g, (_, block) => {
57
+ // AsciiDoc pipe-delimited tables: |=== ... |===
58
+ let result = text.replace(/\|===\n([\s\S]*?)\n\|===/g, (_, body) => {
59
+ const rows = body.split('\n').filter(line => line.trim().length > 0);
60
+ const htmlRows = rows.map(row => {
61
+ // Each row starts with "| " — strip the leading pipe then split on " | "
62
+ const cells = row.replace(/^\| */, '').split(/ \| /);
63
+ const htmlCells = cells.map(c => `<td>${c.trim()}</td>`).join('');
64
+ return `<tr>${htmlCells}</tr>`;
65
+ });
66
+ return `<table class="concept-table">${htmlRows.join('')}</table>`;
67
+ });
68
+
69
+ // Bullet lists: * item
70
+ result = result.replace(/(?:^|\n)((?:[ \t]*\* [^\n]+)(?:\n[ \t]*\* [^\n]+)*)/g, (_, block) => {
58
71
  if (/^\*stem:\[/.test(block.trimStart())) return _;
59
72
  const items: string[] = [];
60
73
  const re = /[ \t]*\* ([^\n]+)/g;
@@ -67,6 +80,7 @@ function convertLists(text: string): string {
67
80
  return `\n<ul class="concept-list">${lis}</ul>`;
68
81
  });
69
82
 
83
+ // Numbered lists: 1) item or 1. item
70
84
  result = result.replace(/(?:^|\n)((?:[ \t]*\d+[).][ \t]+[^\n]+)(?:\n[ \t]*\d+[).][ \t]+[^\n]+)*)/g, (_, block) => {
71
85
  const items: string[] = [];
72
86
  const re = /[ \t]*\d+[).][ \t]+([^\n]+)/g;