@youtyan/code-viewer 0.1.22 → 0.1.23

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": "@youtyan/code-viewer",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "description": "Local browser-based code and git diff viewer",
5
5
  "type": "module",
6
6
  "bin": {
package/web/app.js CHANGED
@@ -6518,7 +6518,7 @@ ${frontmatter.yaml}
6518
6518
  });
6519
6519
  }
6520
6520
  function buildMarkdownToc(root) {
6521
- const entries = Array.from(root.querySelectorAll("h1[id], h2[id], h3[id]")).map((heading2) => ({
6521
+ const entries = Array.from(root.querySelectorAll("h1[id], h2[id], h3[id], h4[id]")).map((heading2) => ({
6522
6522
  id: heading2.id,
6523
6523
  level: Number(heading2.tagName.slice(1)),
6524
6524
  text: (heading2.textContent || "").replace(/#$/, "").trim()
@@ -6537,6 +6537,7 @@ ${frontmatter.yaml}
6537
6537
  link2.href = `#${encodeURIComponent(entry.id)}`;
6538
6538
  link2.dataset.target = entry.id;
6539
6539
  link2.textContent = entry.text;
6540
+ link2.title = entry.text;
6540
6541
  item.appendChild(link2);
6541
6542
  list2.appendChild(item);
6542
6543
  });
package/web/style.css CHANGED
@@ -2600,49 +2600,53 @@ table.d2h-diff-table tr.gdp-diff-line-target > td:first-child {
2600
2600
  }
2601
2601
  .gdp-html-preview {
2602
2602
  width: 100%;
2603
- min-height: min(78vh, 920px);
2603
+ min-height: calc(100vh - var(--global-header-h) - 118px);
2604
2604
  background: var(--bg);
2605
2605
  }
2606
2606
  .gdp-html-preview iframe {
2607
2607
  display: block;
2608
2608
  width: 100%;
2609
- min-height: min(78vh, 920px);
2609
+ min-height: calc(100vh - var(--global-header-h) - 118px);
2610
2610
  border: 0;
2611
2611
  background: #fff;
2612
2612
  }
2613
2613
  .gdp-markdown-layout {
2614
2614
  display: grid;
2615
- grid-template-columns: 260px minmax(0, 1fr);
2616
- gap: 32px;
2615
+ grid-template-columns: 280px minmax(0, 1fr);
2616
+ gap: 28px;
2617
2617
  align-items: start;
2618
2618
  }
2619
- .gdp-standalone-source .gdp-markdown-layout {
2620
- grid-template-columns: minmax(0, 1fr);
2621
- }
2622
- .gdp-standalone-source .gdp-markdown-toc {
2623
- display: none;
2624
- }
2625
2619
  .gdp-markdown-toc {
2626
2620
  position: sticky;
2627
- top: 96px;
2628
- max-height: calc(100vh - 120px);
2621
+ top: calc(var(--global-header-h) + 16px);
2622
+ max-height: calc(100vh - var(--global-header-h) - 40px);
2629
2623
  overflow: auto;
2630
- padding: 18px 14px;
2631
- border-right: 1px solid var(--border);
2632
- background: var(--bg-soft);
2624
+ padding: 8px 12px 10px 0;
2625
+ border-right: 1px solid var(--border-muted);
2626
+ background: transparent;
2633
2627
  font-size: 13px;
2634
2628
  line-height: 1.45;
2629
+ scrollbar-gutter: stable;
2630
+ scrollbar-width: thin;
2631
+ scrollbar-color: var(--border) transparent;
2632
+ }
2633
+ .gdp-markdown-toc::-webkit-scrollbar {
2634
+ width: 8px;
2635
+ }
2636
+ .gdp-markdown-toc::-webkit-scrollbar-thumb {
2637
+ border-radius: 4px;
2638
+ background: var(--border);
2635
2639
  }
2636
2640
  .gdp-markdown-toc::before {
2637
- content: "Contents";
2641
+ content: "On this page";
2638
2642
  display: block;
2639
- margin: 0 8px 12px;
2640
- padding-bottom: 10px;
2643
+ margin: 0 0 10px 2px;
2644
+ padding: 0 8px 10px;
2641
2645
  border-bottom: 1px solid var(--border-muted);
2642
2646
  color: var(--fg-muted);
2643
2647
  font-size: 11px;
2644
- font-weight: 700;
2645
- letter-spacing: 0.12em;
2648
+ font-weight: 600;
2649
+ letter-spacing: 0.06em;
2646
2650
  text-transform: uppercase;
2647
2651
  }
2648
2652
  .gdp-markdown-toc ul {
@@ -2654,33 +2658,47 @@ table.d2h-diff-table tr.gdp-diff-line-target > td:first-child {
2654
2658
  margin: 0;
2655
2659
  }
2656
2660
  .gdp-markdown-toc a {
2657
- display: block;
2658
- padding: 5px 8px;
2659
- border-left: 2px solid transparent;
2661
+ display: -webkit-box;
2662
+ min-height: 28px;
2663
+ padding: 5px 10px 5px 12px;
2664
+ border-left: 3px solid transparent;
2660
2665
  border-radius: 5px;
2661
2666
  color: var(--fg-muted);
2667
+ overflow: hidden;
2662
2668
  overflow-wrap: anywhere;
2663
2669
  text-decoration: none;
2670
+ -webkit-box-orient: vertical;
2671
+ -webkit-line-clamp: 2;
2672
+ transition:
2673
+ background-color 0.06s ease,
2674
+ border-color 0.06s ease,
2675
+ color 0.06s ease;
2664
2676
  }
2665
2677
  .gdp-markdown-toc .level-1 > a {
2666
2678
  color: var(--fg);
2667
2679
  font-weight: 600;
2668
2680
  }
2669
2681
  .gdp-markdown-toc .level-2 > a {
2670
- padding-left: 18px;
2682
+ padding-left: 24px;
2671
2683
  }
2672
2684
  .gdp-markdown-toc .level-3 > a {
2673
- padding-left: 30px;
2674
- font-size: 12px;
2685
+ padding-left: 38px;
2686
+ }
2687
+ .gdp-markdown-toc .level-4 > a {
2688
+ padding-left: 52px;
2675
2689
  }
2676
2690
  .gdp-markdown-toc a:hover {
2677
2691
  background: var(--bg-mute);
2678
2692
  color: var(--fg);
2679
2693
  }
2694
+ .gdp-markdown-toc a:focus-visible {
2695
+ outline: 2px solid var(--accent);
2696
+ outline-offset: -2px;
2697
+ }
2680
2698
  .gdp-markdown-toc a.active {
2681
2699
  background: var(--accent-subtle);
2682
2700
  border-left-color: var(--accent);
2683
- color: var(--accent-emph);
2701
+ color: var(--fg);
2684
2702
  font-weight: 600;
2685
2703
  }
2686
2704
  .gdp-markdown-preview h1,