pict-section-content 0.0.4 → 0.0.5
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
|
@@ -355,8 +355,14 @@ class PictContentProvider extends libPictProvider
|
|
|
355
355
|
|
|
356
356
|
let tmpResult = pText;
|
|
357
357
|
|
|
358
|
-
//
|
|
359
|
-
|
|
358
|
+
// Extract inline code spans into placeholders so bold/italic regexes don't mangle their contents
|
|
359
|
+
let tmpCodeSpans = [];
|
|
360
|
+
tmpResult = tmpResult.replace(/`([^`]+)`/g, (pMatch, pCode) =>
|
|
361
|
+
{
|
|
362
|
+
let tmpIndex = tmpCodeSpans.length;
|
|
363
|
+
tmpCodeSpans.push('<code>' + pCode + '</code>');
|
|
364
|
+
return '\x00CODEINLINE' + tmpIndex + '\x00';
|
|
365
|
+
});
|
|
360
366
|
|
|
361
367
|
// Inline LaTeX equations ($...$) — must be processed before other inline patterns
|
|
362
368
|
// Match single $ delimiters that aren't adjacent to spaces (to avoid false positives with currency)
|
|
@@ -396,6 +402,12 @@ class PictContentProvider extends libPictProvider
|
|
|
396
402
|
tmpResult = tmpResult.replace(/\*([^*]+)\*/g, '<em>$1</em>');
|
|
397
403
|
tmpResult = tmpResult.replace(/_([^_]+)_/g, '<em>$1</em>');
|
|
398
404
|
|
|
405
|
+
// Restore inline code spans from placeholders
|
|
406
|
+
tmpResult = tmpResult.replace(/\x00CODEINLINE(\d+)\x00/g, (pMatch, pIndex) =>
|
|
407
|
+
{
|
|
408
|
+
return tmpCodeSpans[parseInt(pIndex)];
|
|
409
|
+
});
|
|
410
|
+
|
|
399
411
|
return tmpResult;
|
|
400
412
|
}
|
|
401
413
|
|