@crestapps/ai-chat-ui 2.0.0-preview.187 → 2.0.0-preview.191

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.
@@ -506,11 +506,20 @@ window.chatInteractionManager = function () {
506
506
  // Parse markdown content via marked (which natively handles [chart:...] markers
507
507
  // through the registered extension) and collect pending chart configs for later
508
508
  // Chart.js rendering.
509
+ // A markdown table becomes a bare <table>, which Bootstrap leaves completely unstyled: it renders
510
+ // as cramped, borderless text that reads as plain output rather than a table. Adding the framework's
511
+ // own classes styles it wherever Bootstrap is loaded, and the wrapper lets a wide table scroll on
512
+ // its own instead of stretching the conversation. Markdown tables cannot nest, so the plain
513
+ // replacement is safe. This page renders markdown through its own pipeline, so the same treatment
514
+ // is applied here as in the shared chat script.
515
+ function styleMarkdownTables(html) {
516
+ return html.replace(/<table>/g, '<div class="table-responsive"><table class="table table-sm table-bordered table-striped align-middle">').replace(/<\/table>/g, '</table></div>');
517
+ }
509
518
  function parseMarkdownContent(content, message) {
510
519
  _pendingCharts = [];
511
- var html = marked.parse(content, {
520
+ var html = styleMarkdownTables(marked.parse(content, {
512
521
  renderer: renderer
513
- });
522
+ }));
514
523
  message._pendingCharts = _pendingCharts.length > 0 ? _toConsumableArray(_pendingCharts) : [];
515
524
  return DOMPurify.sanitize(html, {
516
525
  ADD_TAGS: ['canvas'],