confluence-md-sync 0.8.9 → 0.8.10

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.
@@ -147,10 +147,38 @@ class Converter {
147
147
  // tables:'records' — любую таблицу разворачиваем в записи.
148
148
  if (this.tablesAsRecords)
149
149
  return this.recordsTable(el);
150
- // Простую таблицу — в чистый GFM (оба режима). Сложную tableToMd
151
- // отклоняет: faithful → сырой HTML, readable → readableFallback
152
- // (lossy++ и разворот в GFM через readableTable).
153
- return this.tableToMd(el);
150
+ try {
151
+ return this.tableToMd(el);
152
+ }
153
+ catch (e) {
154
+ if (!(e instanceof Unrepresentable))
155
+ throw e;
156
+ // Строгая GFM-конвертация отклонила таблицу: то ли из-за косметики
157
+ // (Confluence лепит class="wrapped" style="width:…%" на КАЖДУЮ
158
+ // таблицу, а первую строку часто оформляет жирным <td> вместо <th>),
159
+ // то ли из-за реальных объединений (colspan/rowspan). В faithful без
160
+ // этой ветки ЛЮБАЯ такая таблица падала в дословный <table> HTML —
161
+ // нормализуем в GFM тем же путём, что readable (buildTableGrid не
162
+ // смотрит на атрибуты/семантику заголовка): оформление и объединения
163
+ // теряются при повторной публикации, но данные — md-таблица, не теги.
164
+ if (!this.readable) {
165
+ const saved = this.readable;
166
+ this.readable = true;
167
+ try {
168
+ const norm = this.readableTable(el);
169
+ this.stats.normalized++;
170
+ return norm;
171
+ }
172
+ catch (e2) {
173
+ if (!(e2 instanceof Unrepresentable))
174
+ throw e2;
175
+ }
176
+ finally {
177
+ this.readable = saved;
178
+ }
179
+ }
180
+ throw e;
181
+ }
154
182
  }
155
183
  if (el.name === 'ac:structured-macro')
156
184
  return this.macroToMd(el);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "confluence-md-sync",
3
- "version": "0.8.9",
3
+ "version": "0.8.10",
4
4
  "description": "Publish Markdown to Confluence (Data Center & Cloud): idempotent page sync, attachment dedup, tables and a pluggable macro system",
5
5
  "keywords": [
6
6
  "confluence",