@pep/term-deck 1.2.0 → 1.2.2

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.
@@ -696,8 +696,37 @@ var init_mermaid = __esm({
696
696
  });
697
697
 
698
698
  // src/core/content-processor.ts
699
+ function processCodeBlocks(content) {
700
+ return content.replace(CODE_BLOCK_PATTERN, (_match, _lang, code) => {
701
+ const lines = code.trimEnd().split("\n");
702
+ const maxLen = Math.max(...lines.map((l) => l.length), 20);
703
+ const top = "\u250C" + "\u2500".repeat(maxLen + 2) + "\u2510";
704
+ const bottom = "\u2514" + "\u2500".repeat(maxLen + 2) + "\u2518";
705
+ const boxedLines = lines.map((line) => {
706
+ const padded = line.padEnd(maxLen);
707
+ return `\u2502 ${padded} \u2502`;
708
+ });
709
+ return [top, ...boxedLines, bottom].join("\n");
710
+ });
711
+ }
712
+ function processMarkdownInline(content) {
713
+ let result = content;
714
+ result = result.replace(/\*\*([^*]+)\*\*/g, "{bold}$1{/bold}");
715
+ result = result.replace(/__([^_]+)__/g, "{bold}$1{/bold}");
716
+ result = result.replace(/(?<![*\w])\*([^*]+)\*(?![*\w])/g, "{light-black-fg}$1{/light-black-fg}");
717
+ result = result.replace(/(?<![_\w])_([^_]+)_(?![_\w])/g, "{light-black-fg}$1{/light-black-fg}");
718
+ result = result.replace(/`([^`]+)`/g, "{inverse} $1 {/inverse}");
719
+ result = result.replace(/~~([^~]+)~~/g, "{strikethrough}$1{/strikethrough}");
720
+ result = result.replace(/^(#{1,6})\s+(.+)$/gm, "{bold}$2{/bold}");
721
+ result = result.replace(/^[-*_]{3,}$/gm, "\u2500".repeat(40));
722
+ result = result.replace(/^[\s]*[-*+]\s+/gm, " \u2022 ");
723
+ result = result.replace(/^[\s]*(\d+)\.\s+/gm, " $1. ");
724
+ return result;
725
+ }
699
726
  async function processSlideContent(body, theme) {
700
727
  let processed = processMermaidDiagrams(body);
728
+ processed = processCodeBlocks(processed);
729
+ processed = processMarkdownInline(processed);
701
730
  processed = colorTokensToBlessedTags(processed, theme);
702
731
  return processed;
703
732
  }
@@ -705,11 +734,13 @@ function normalizeBigText(bigText) {
705
734
  if (!bigText) return [];
706
735
  return Array.isArray(bigText) ? bigText : [bigText];
707
736
  }
737
+ var CODE_BLOCK_PATTERN;
708
738
  var init_content_processor = __esm({
709
739
  "src/core/content-processor.ts"() {
710
740
  init_esm_shims();
711
741
  init_theme2();
712
742
  init_mermaid();
743
+ CODE_BLOCK_PATTERN = /```(\w*)\n([\s\S]*?)```/g;
713
744
  }
714
745
  });
715
746
 
@@ -3668,7 +3699,7 @@ var init_main = __esm({
3668
3699
  init_esm_shims();
3669
3700
 
3670
3701
  // package.json
3671
- var version = "1.2.0";
3702
+ var version = "1.2.2";
3672
3703
 
3673
3704
  // src/cli/commands/present.ts
3674
3705
  init_esm_shims();