hd-garden 0.6.0 → 0.7.0

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.
Files changed (46) hide show
  1. package/app/admin/preview/[...path]/page.tsx +1 -1
  2. package/app/blog/[...path]/page.tsx +2 -2
  3. package/app/columns/[column]/[...path]/page.tsx +2 -2
  4. package/app/components/ArticleMeasure.tsx +39 -4
  5. package/app/components/GardenDocsNav.tsx +184 -0
  6. package/app/components/MarkdownArticle.tsx +7 -6
  7. package/app/components/SiteChrome.tsx +1 -1
  8. package/app/components/SiteFooter.tsx +10 -3
  9. package/app/garden/[...slug]/page.tsx +148 -0
  10. package/app/garden/page.tsx +61 -128
  11. package/app/garden-modules.d.ts +15 -0
  12. package/app/globals.css +10 -10
  13. package/app/lib/content.ts +16 -10
  14. package/app/lib/garden-docs-meta.ts +83 -0
  15. package/app/lib/heading-number.ts +13 -0
  16. package/app/styles/a2.css +531 -0
  17. package/docs/handbook/assets/reading-layout.svg +26 -0
  18. package/docs/handbook/components/card.md +44 -0
  19. package/docs/handbook/components/chart.md +52 -0
  20. package/docs/handbook/components/compare.md +40 -0
  21. package/docs/handbook/components/figure.md +70 -0
  22. package/docs/handbook/components/file/checklist.md +17 -0
  23. package/docs/handbook/components/file.md +32 -0
  24. package/docs/handbook/components/html.md +67 -0
  25. package/docs/handbook/components/interactive.md +65 -0
  26. package/docs/handbook/components/stat.md +55 -0
  27. package/docs/handbook/components/timeline.md +50 -0
  28. package/docs/handbook/components.md +30 -0
  29. package/docs/handbook/config.md +125 -0
  30. package/docs/handbook/deploy.md +273 -0
  31. package/docs/handbook/design.md +81 -0
  32. package/docs/handbook/index.md +92 -0
  33. package/docs/handbook/start.md +92 -0
  34. package/docs/handbook/workflow.md +81 -0
  35. package/docs/handbook/writing.md +148 -0
  36. package/package.json +2 -1
  37. package/scripts/build-content.mjs +124 -15
  38. package/scripts/handbook-allowlist.mjs +68 -0
  39. package/scripts/handbook-facts.mjs +1104 -0
  40. package/scripts/prepare-pages-output.mjs +32 -9
  41. package/site.config.yaml +2 -2
  42. package/templates/garden-blocks.md +1 -1
  43. package/templates/site/package.json +1 -3
  44. package/ui/garden/catalog.mjs +1 -1
  45. package/ui/preview/dist/garden-ui.esm.js +1 -1
  46. package/ui/preview/dist/garden-ui.iife.js +1 -1
package/app/styles/a2.css CHANGED
@@ -1041,6 +1041,42 @@ html[data-theme="dark"] .markdown-body > p > img:not([class]) {
1041
1041
  color: var(--ink);
1042
1042
  }
1043
1043
 
1044
+ .g-cmp dl {
1045
+ display: flex;
1046
+ flex-wrap: wrap;
1047
+ gap: 6px;
1048
+ margin: 10px 0 0;
1049
+ padding-top: 10px;
1050
+ border-top: 1px solid var(--rule);
1051
+ }
1052
+
1053
+ .g-cmp dl > span {
1054
+ display: inline-flex;
1055
+ align-items: baseline;
1056
+ gap: 5px;
1057
+ padding: 2px 8px;
1058
+ border-radius: 6px;
1059
+ background: var(--well);
1060
+ font: 400 12px / 1.45 var(--sans);
1061
+ }
1062
+
1063
+ .g-cmp dt {
1064
+ margin: 0;
1065
+ color: var(--muted);
1066
+ }
1067
+
1068
+ .g-cmp dt::after {
1069
+ content: "·";
1070
+ margin-left: 5px;
1071
+ color: var(--muted);
1072
+ }
1073
+
1074
+ .g-cmp dd {
1075
+ margin: 0;
1076
+ font-weight: 500;
1077
+ color: var(--ink);
1078
+ }
1079
+
1044
1080
  .g-cmp p,
1045
1081
  .g-card p,
1046
1082
  .g-tl-x {
@@ -1698,3 +1734,498 @@ html[data-theme="dark"] .gf-scrim { background: rgb(0 0 0 / 45%); }
1698
1734
  .gf-db .gf-doc p, .gf-db .gf-doc li { font-size: 15px; line-height: 1.75; }
1699
1735
  .gf-db .gf-doc p { margin: 0 0 14px; }
1700
1736
  .gf-db .gf-doc ul, .gf-db .gf-doc ol { margin: 0 0 14px; }
1737
+
1738
+ /* ===== Garden Handbook (/garden & /garden/[...slug]) ===== */
1739
+
1740
+ .garden-doc-page {
1741
+ width: min(1380px, calc(100% - 48px));
1742
+ margin: 0 auto;
1743
+ padding: 44px 0 112px;
1744
+ display: grid;
1745
+ grid-template-columns: 224px minmax(0, var(--col)) 188px;
1746
+ gap: 0 24px;
1747
+ align-items: start;
1748
+ justify-content: space-between;
1749
+ font-family: var(--sans);
1750
+ }
1751
+
1752
+ .garden-doc-page .g-explore:not([data-sel="all"]) .dx-wrap [data-p]:not(.on),
1753
+ .garden-doc-page .g-explore:not([data-sel="all"]) .dx-wrap text:not(.on),
1754
+ .garden-doc-page .g-figure:not([data-sel="all"]) [data-p]:not(.on),
1755
+ .garden-doc-page .g-figure:not([data-sel="all"]) text:not(.on) {
1756
+ opacity: 0.56;
1757
+ }
1758
+
1759
+ .garden-doc-page > .toc {
1760
+ margin-top: 8px;
1761
+ position: sticky;
1762
+ top: calc(var(--hdr) + 28px);
1763
+ max-height: calc(100vh - var(--hdr) - 48px);
1764
+ overflow-y: auto;
1765
+ border-left: 0;
1766
+ padding: 4px 0 24px;
1767
+ }
1768
+
1769
+ /* Mobile chapter bar & backdrop (hidden on desktop) */
1770
+ .gdoc-mobile-bar,
1771
+ .gdoc-backdrop,
1772
+ .gdoc-mobile-close,
1773
+ .gdoc-nojs-trigger,
1774
+ .gdoc-nojs-close {
1775
+ display: none;
1776
+ }
1777
+
1778
+ /* Left Handbook Sidebar */
1779
+ .gdoc-sidebar {
1780
+ position: sticky;
1781
+ top: calc(var(--hdr) + 24px);
1782
+ max-height: calc(100vh - var(--hdr) - 40px);
1783
+ overflow-y: auto;
1784
+ padding-right: 16px;
1785
+ border-right: 1px solid var(--rule);
1786
+ scrollbar-width: thin;
1787
+ }
1788
+
1789
+ .gdoc-sidebar-head {
1790
+ padding-bottom: 14px;
1791
+ margin-bottom: 16px;
1792
+ border-bottom: 1px solid var(--rule);
1793
+ }
1794
+
1795
+ .gdoc-overview-link {
1796
+ display: flex;
1797
+ flex-direction: column;
1798
+ gap: 3px;
1799
+ padding: 8px 10px;
1800
+ border-radius: 10px;
1801
+ color: var(--ink);
1802
+ text-decoration: none;
1803
+ transition: background-color 0.15s ease;
1804
+ }
1805
+
1806
+ .gdoc-overview-link:hover {
1807
+ background: var(--tint);
1808
+ }
1809
+
1810
+ .gdoc-overview-link[aria-current="page"] {
1811
+ background: var(--well);
1812
+ }
1813
+
1814
+ .gdoc-overview-mark {
1815
+ display: inline-flex;
1816
+ align-items: center;
1817
+ gap: 7px;
1818
+ font: 600 15px/1.3 var(--serif);
1819
+ color: var(--ink);
1820
+ }
1821
+
1822
+ .gdoc-overview-link small {
1823
+ padding-left: 23px;
1824
+ font-size: 12px;
1825
+ line-height: 1.4;
1826
+ color: var(--muted);
1827
+ }
1828
+
1829
+ .gdoc-nav {
1830
+ display: flex;
1831
+ flex-direction: column;
1832
+ gap: 20px;
1833
+ }
1834
+
1835
+ .gdoc-nav-group-head {
1836
+ display: flex;
1837
+ align-items: baseline;
1838
+ justify-content: space-between;
1839
+ gap: 8px;
1840
+ padding: 0 10px;
1841
+ margin-bottom: 6px;
1842
+ }
1843
+
1844
+ .gdoc-nav-group-head h2 {
1845
+ margin: 0;
1846
+ font: 600 12px/1.4 var(--sans);
1847
+ letter-spacing: 0.02em;
1848
+ color: var(--muted);
1849
+ }
1850
+
1851
+ .gdoc-nav-group-head span {
1852
+ font: 400 11px/1.3 var(--mono);
1853
+ color: var(--muted);
1854
+ opacity: 0.8;
1855
+ }
1856
+
1857
+ .gdoc-nav-list {
1858
+ list-style: none;
1859
+ margin: 0;
1860
+ padding: 0;
1861
+ display: flex;
1862
+ flex-direction: column;
1863
+ gap: 2px;
1864
+ }
1865
+
1866
+ .gdoc-nav-list li {
1867
+ margin: 0;
1868
+ padding: 0;
1869
+ }
1870
+
1871
+ .gdoc-nav-list a {
1872
+ display: flex;
1873
+ align-items: center;
1874
+ gap: 8px;
1875
+ padding: 6px 10px;
1876
+ border-radius: 8px;
1877
+ font-size: 14px;
1878
+ line-height: 1.45;
1879
+ color: var(--soft);
1880
+ text-decoration: none;
1881
+ transition: background-color 0.15s ease, color 0.15s ease;
1882
+ }
1883
+
1884
+ .gdoc-nav-list a:hover {
1885
+ background: var(--tint);
1886
+ color: var(--ink);
1887
+ }
1888
+
1889
+ .gdoc-nav-list li.is-active a,
1890
+ .gdoc-nav-list a[aria-current="page"] {
1891
+ background: var(--well);
1892
+ color: var(--ink);
1893
+ font-weight: 600;
1894
+ }
1895
+
1896
+ .gdoc-comp-pill {
1897
+ flex: none;
1898
+ padding: 1px 6px;
1899
+ border-radius: 5px;
1900
+ border: 1px solid var(--rule-strong);
1901
+ background: var(--card);
1902
+ font: 500 12px/1.4 var(--mono);
1903
+ color: var(--ink);
1904
+ }
1905
+
1906
+ .gdoc-nav-list li.is-active .gdoc-comp-pill {
1907
+ background: var(--ink);
1908
+ border-color: var(--ink);
1909
+ color: var(--paper);
1910
+ }
1911
+
1912
+ .gdoc-comp-label {
1913
+ min-width: 0;
1914
+ overflow: hidden;
1915
+ text-overflow: ellipsis;
1916
+ white-space: nowrap;
1917
+ }
1918
+
1919
+ /* Chapter Article Column */
1920
+ .garden-doc-article {
1921
+ min-width: 0;
1922
+ max-width: var(--col);
1923
+ width: 100%;
1924
+ }
1925
+
1926
+ .gdoc-article-head {
1927
+ padding: 4px 0 28px;
1928
+ margin-bottom: 32px;
1929
+ border-bottom: 1px solid var(--rule);
1930
+ }
1931
+
1932
+ .gdoc-eyebrow {
1933
+ display: flex;
1934
+ flex-wrap: wrap;
1935
+ align-items: center;
1936
+ gap: 8px;
1937
+ margin-bottom: 12px;
1938
+ font-size: 13px;
1939
+ line-height: 1.5;
1940
+ color: var(--muted);
1941
+ }
1942
+
1943
+ .gdoc-eyebrow-root {
1944
+ color: var(--soft);
1945
+ text-decoration: none;
1946
+ font-weight: 500;
1947
+ }
1948
+
1949
+ .gdoc-eyebrow-root:hover {
1950
+ color: var(--ink);
1951
+ text-decoration: underline;
1952
+ text-underline-offset: 3px;
1953
+ }
1954
+
1955
+ .gdoc-eyebrow-fence {
1956
+ padding: 2px 8px;
1957
+ border-radius: 6px;
1958
+ background: var(--well);
1959
+ border: 1px solid var(--rule);
1960
+ font: 500 12px/1.4 var(--mono);
1961
+ color: var(--ink);
1962
+ }
1963
+
1964
+ .gdoc-article-head h1 {
1965
+ margin: 0;
1966
+ font: 700 clamp(28px, 3.4vw, 38px) / 1.24 var(--sans);
1967
+ color: var(--ink);
1968
+ letter-spacing: -0.015em;
1969
+ text-wrap: balance;
1970
+ }
1971
+
1972
+ .gdoc-article-head h1.h1-br {
1973
+ white-space: normal;
1974
+ max-width: none;
1975
+ }
1976
+
1977
+ @media (min-width: 768px) {
1978
+ .gdoc-article-head h1.h1-br {
1979
+ font-size: min(clamp(28px, 3.4vw, 38px), calc(min(100vw - 80px, 740px) / var(--l)));
1980
+ }
1981
+ }
1982
+
1983
+ .gdoc-article-deck {
1984
+ margin: 14px 0 0;
1985
+ font-size: 18px;
1986
+ line-height: 1.65;
1987
+ color: var(--soft);
1988
+ }
1989
+
1990
+ .garden-doc-article .markdown-body h2:first-child {
1991
+ margin-top: 8px;
1992
+ }
1993
+
1994
+ /* Prev / Next Pager */
1995
+ .gdoc-pager {
1996
+ display: grid;
1997
+ grid-template-columns: repeat(2, minmax(0, 1fr));
1998
+ gap: 16px;
1999
+ margin-top: 64px;
2000
+ padding-top: 28px;
2001
+ border-top: 1px solid var(--rule);
2002
+ }
2003
+
2004
+ .gdoc-pager-card {
2005
+ display: flex;
2006
+ flex-direction: column;
2007
+ gap: 6px;
2008
+ padding: 16px 18px;
2009
+ border: 1px solid var(--rule);
2010
+ border-radius: 12px;
2011
+ background: var(--card);
2012
+ text-decoration: none;
2013
+ transition: border-color 0.15s ease, background-color 0.15s ease;
2014
+ }
2015
+
2016
+ .gdoc-pager-card:hover {
2017
+ border-color: var(--rule-strong);
2018
+ background: var(--card-hover);
2019
+ }
2020
+
2021
+ .gdoc-pager-card.is-next {
2022
+ grid-column: 2;
2023
+ text-align: right;
2024
+ align-items: flex-end;
2025
+ }
2026
+
2027
+ .gdoc-pager-dir {
2028
+ display: inline-flex;
2029
+ align-items: center;
2030
+ gap: 5px;
2031
+ font-size: 12px;
2032
+ color: var(--muted);
2033
+ }
2034
+
2035
+ .gdoc-pager-card strong {
2036
+ font-size: 15px;
2037
+ font-weight: 600;
2038
+ line-height: 1.45;
2039
+ color: var(--ink);
2040
+ }
2041
+
2042
+ /* Responsive Breakpoints */
2043
+ @media (max-width: 1260px) {
2044
+ .garden-doc-page {
2045
+ grid-template-columns: 220px minmax(0, var(--col));
2046
+ justify-content: center;
2047
+ gap: 0 44px;
2048
+ }
2049
+
2050
+ .garden-doc-page > .toc {
2051
+ display: none;
2052
+ }
2053
+ }
2054
+
2055
+ @media (max-width: 1080px) {
2056
+ .garden-doc-page {
2057
+ display: block;
2058
+ width: min(var(--col), calc(100% - 40px));
2059
+ padding: 20px 0 88px;
2060
+ }
2061
+
2062
+ .gdoc-mobile-bar {
2063
+ display: flex;
2064
+ align-items: center;
2065
+ gap: 12px;
2066
+ padding: 10px 14px;
2067
+ margin-bottom: 24px;
2068
+ border: 1px solid var(--rule);
2069
+ border-radius: 10px;
2070
+ background: var(--card);
2071
+ }
2072
+
2073
+ .gdoc-mobile-trigger,
2074
+ .gdoc-nojs-trigger {
2075
+ display: inline-flex;
2076
+ align-items: center;
2077
+ gap: 6px;
2078
+ min-height: 34px;
2079
+ padding: 0 12px;
2080
+ border: 1px solid var(--rule-strong);
2081
+ border-radius: 8px;
2082
+ background: var(--well);
2083
+ font: 600 13px/1 var(--sans);
2084
+ color: var(--ink);
2085
+ cursor: pointer;
2086
+ white-space: nowrap;
2087
+ }
2088
+
2089
+ .gdoc-nojs-trigger {
2090
+ display: none;
2091
+ text-decoration: none;
2092
+ }
2093
+
2094
+ .gdoc-mobile-crumb {
2095
+ display: flex;
2096
+ align-items: center;
2097
+ gap: 6px;
2098
+ min-width: 0;
2099
+ overflow: hidden;
2100
+ white-space: nowrap;
2101
+ font-size: 13px;
2102
+ color: var(--muted);
2103
+ }
2104
+
2105
+ .gdoc-mobile-crumb > span,
2106
+ .gdoc-mobile-crumb > svg {
2107
+ flex-shrink: 0;
2108
+ white-space: nowrap;
2109
+ }
2110
+
2111
+ .gdoc-mobile-crumb strong {
2112
+ min-width: 0;
2113
+ color: var(--ink);
2114
+ font-weight: 600;
2115
+ overflow: hidden;
2116
+ text-overflow: ellipsis;
2117
+ white-space: nowrap;
2118
+ }
2119
+
2120
+ .gdoc-backdrop {
2121
+ display: block;
2122
+ position: fixed;
2123
+ inset: 0;
2124
+ z-index: 82;
2125
+ border: 0;
2126
+ padding: 0;
2127
+ background: rgb(20 20 19 / 34%);
2128
+ opacity: 0;
2129
+ visibility: hidden;
2130
+ pointer-events: none;
2131
+ transition: opacity 0.18s ease, visibility 0s linear 0.18s;
2132
+ }
2133
+
2134
+ .gdoc-backdrop[data-open="true"] {
2135
+ opacity: 1;
2136
+ visibility: visible;
2137
+ pointer-events: auto;
2138
+ transition: opacity 0.18s ease, visibility 0s;
2139
+ }
2140
+
2141
+ .gdoc-sidebar {
2142
+ position: fixed;
2143
+ top: 0;
2144
+ left: 0;
2145
+ bottom: 0;
2146
+ z-index: 84;
2147
+ width: min(320px, 86vw);
2148
+ max-height: none;
2149
+ padding: 20px 18px 36px;
2150
+ border-right: 1px solid var(--rule);
2151
+ background: var(--paper);
2152
+ box-shadow: 12px 0 36px rgb(0 0 0 / 14%);
2153
+ transform: translateX(-104%);
2154
+ visibility: hidden;
2155
+ pointer-events: none;
2156
+ transition: transform 0.2s ease, visibility 0s linear 0.2s;
2157
+ }
2158
+
2159
+ .gdoc-sidebar[data-open="true"] {
2160
+ transform: translateX(0);
2161
+ visibility: visible;
2162
+ pointer-events: auto;
2163
+ transition: transform 0.2s ease, visibility 0s;
2164
+ }
2165
+
2166
+ .gdoc-sidebar-head {
2167
+ display: flex;
2168
+ align-items: center;
2169
+ justify-content: space-between;
2170
+ gap: 10px;
2171
+ }
2172
+
2173
+ .gdoc-mobile-close {
2174
+ display: inline-grid;
2175
+ place-items: center;
2176
+ width: 34px;
2177
+ height: 34px;
2178
+ border: 1px solid var(--rule);
2179
+ border-radius: 50%;
2180
+ background: var(--well);
2181
+ color: var(--ink);
2182
+ }
2183
+ }
2184
+
2185
+ @media (max-width: 1080px) and (scripting: none) {
2186
+ .gdoc-mobile-trigger,
2187
+ .gdoc-mobile-close {
2188
+ display: none;
2189
+ }
2190
+
2191
+ .gdoc-nojs-trigger {
2192
+ display: inline-flex;
2193
+ }
2194
+
2195
+ .gdoc-nojs-close {
2196
+ display: inline-grid;
2197
+ place-items: center;
2198
+ width: 34px;
2199
+ height: 34px;
2200
+ border: 1px solid var(--rule);
2201
+ border-radius: 50%;
2202
+ background: var(--well);
2203
+ color: var(--ink);
2204
+ text-decoration: none;
2205
+ }
2206
+
2207
+ .gdoc-sidebar:target {
2208
+ transform: translateX(0);
2209
+ visibility: visible;
2210
+ pointer-events: auto;
2211
+ }
2212
+ }
2213
+
2214
+ @media (max-width: 900px) {
2215
+ .garden-doc-page > .toc {
2216
+ display: flex;
2217
+ }
2218
+ }
2219
+
2220
+ @media (max-width: 720px) {
2221
+ .gdoc-pager {
2222
+ grid-template-columns: minmax(0, 1fr);
2223
+ }
2224
+
2225
+ .gdoc-pager-card.is-next {
2226
+ grid-column: 1;
2227
+ text-align: left;
2228
+ align-items: flex-start;
2229
+ }
2230
+ }
2231
+
@@ -0,0 +1,26 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="2080" height="560" viewBox="0 0 1040 280" fill="none" font-family="-apple-system, BlinkMacSystemFont, 'PingFang SC', 'Noto Sans SC', sans-serif">
2
+ <!-- Outer 1340px wide-table boundary -->
3
+ <rect x="20" y="20" width="1000" height="240" rx="14" stroke="#6e6b64" stroke-width="1.5" stroke-dasharray="6 5" />
4
+ <text x="44" y="48" fill="#4a4844" font-size="13" font-weight="600">多列表格外扩区 · 文章页上限 1340px(单侧最多外扩 300px)</text>
5
+ <text x="996" y="48" text-anchor="end" fill="#6e6b64" font-size="12" font-family="ui-monospace, SFMono-Regular, Menlo, monospace">max 1340px</text>
6
+
7
+ <!-- Middle 1040px wide-figure boundary -->
8
+ <rect x="110" y="66" width="820" height="174" rx="12" stroke="#2d2c29" stroke-width="1.5" stroke-dasharray="4 4" />
9
+ <text x="132" y="92" fill="#2d2c29" font-size="13" font-weight="600">宽幅配图外扩区 · 文章页上限 1040px(截图按像素宽度的一半显示,超过 740px 才外扩)</text>
10
+ <text x="908" y="92" text-anchor="end" fill="#6e6b64" font-size="12" font-family="ui-monospace, SFMono-Regular, Menlo, monospace">max 1040px</text>
11
+
12
+ <!-- Inner 740px reading column -->
13
+ <rect x="215" y="110" width="610" height="110" rx="10" fill="#f0eee6" fill-opacity="0.72" stroke="#1b1a18" stroke-width="2" />
14
+ <text x="520" y="146" text-anchor="middle" fill="#1b1a18" font-size="16" font-weight="700">正文阅读列 · 740px(var(--col))</text>
15
+ <text x="520" y="172" text-anchor="middle" fill="#2d2c29" font-size="13">段落、列表、引用、代码块与公式默认收敛在此列内</text>
16
+ <text x="520" y="196" text-anchor="middle" fill="#6e6b64" font-size="12" font-family="ui-monospace, SFMono-Regular, Menlo, monospace">暗色模式透明底配图自动补 var(--image-backing) #faf9f5 暖白底</text>
17
+
18
+ <!-- Left & right expansion arrows -->
19
+ <path d="M210 165 H118" stroke="#2d2c29" stroke-width="1.5" />
20
+ <path d="M124 160 L116 165 L124 170" stroke="#2d2c29" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
21
+ <text x="164" y="156" text-anchor="middle" fill="#4a4844" font-size="11" font-family="ui-monospace, SFMono-Regular, Menlo, monospace">≤ 150px</text>
22
+
23
+ <path d="M830 165 H922" stroke="#2d2c29" stroke-width="1.5" />
24
+ <path d="M916 160 L924 165 L916 170" stroke="#2d2c29" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
25
+ <text x="876" y="156" text-anchor="middle" fill="#4a4844" font-size="11" font-family="ui-monospace, SFMono-Regular, Menlo, monospace">≤ 150px</text>
26
+ </svg>
@@ -0,0 +1,44 @@
1
+ ---
2
+ title: 知识卡片(card)
3
+ navTitle: 知识卡片
4
+ description: 把论文、项目或模块说明整理成带元数据与编号要点的卡片。
5
+ section: components
6
+ order: 31
7
+ badge: card
8
+ ---
9
+
10
+ ```garden card
11
+ title: SQLite WAL 写入模式
12
+ url: https://www.sqlite.org/wal.html
13
+ meta: 文档说明 · sqlite.org
14
+ description: 把修改先顺序追加到预写日志,读操作继续访问原数据库页,减少读写互斥等待。
15
+ points:
16
+ - 写入只追加到 `-wal` 文件末尾,不需要在事务提交时原地覆盖数据页。
17
+ - 读事务记录当前末尾偏移量即可看到一致快照,不会阻塞并发写入。
18
+ - 后台 Checkpoint 按阈值将日志页分批写回主库文件。
19
+ ```
20
+
21
+ ````markdown
22
+ ```garden card
23
+ title: SQLite WAL 写入模式
24
+ url: https://www.sqlite.org/wal.html
25
+ meta: 文档说明 · sqlite.org
26
+ description: 把修改先顺序追加到预写日志,读操作继续访问原数据库页,减少读写互斥等待。
27
+ points:
28
+ - 写入只追加到 `-wal` 文件末尾,不需要在事务提交时原地覆盖数据页。
29
+ - 读事务记录当前末尾偏移量即可看到一致快照,不会阻塞并发写入。
30
+ - 后台 Checkpoint 按阈值将日志页分批写回主库文件。
31
+ ```
32
+ ````
33
+
34
+ - **用**:介绍一篇论文、一个开源项目或某个子系统,需要带出来源链接和 2~4 条关键要点时。
35
+ - **别用**:只有一两句普通说明时直接写正文段落或链接卡片(`{card}`),不要套一层 `card`。
36
+
37
+ | 字段 | 必填 | 类型 | 说明 |
38
+ | :--- | :--- | :--- | :--- |
39
+ | `title` | 建议 | 字符串 | 卡片标题 |
40
+ | `url` | 否 | 完整链接 | 标题旁显示的外部链接(渲染为 `来源 ↗`) |
41
+ | `meta` | 否 | 字符串 | 标题下方的副标题或元信息说明 |
42
+ | `description` | 与 `points` 二选一 | 字符串 | 卡片主说明段落(支持行内加粗与代码) |
43
+ | `points` | 与 `description` 二选一 | 字符串数组 | 下方带编号的要点列表 |
44
+ | `source` | 否 | 字符串或 `{ title, url }` | 右下角出处角标 |
@@ -0,0 +1,52 @@
1
+ ---
2
+ title: 条形图表(chart)
3
+ navTitle: 条形图表
4
+ description: 用 YAML 数据直接生成比例条形图,下方自带可展开的数据表格。
5
+ section: components
6
+ order: 35
7
+ badge: chart
8
+ ---
9
+
10
+ ```garden chart
11
+ title: 三种版面区域的宽度上限
12
+ xLabel: 版面区域
13
+ yLabel: 最大宽度
14
+ unit: px
15
+ data:
16
+ - x: 普通正文列
17
+ y: 740
18
+ - x: 宽幅配图区
19
+ y: 1040
20
+ - x: 多列宽表格
21
+ y: 1340
22
+ caption: 点击「查看数据表」可展开完整数值表格。
23
+ ```
24
+
25
+ ````markdown
26
+ ```garden chart
27
+ title: 三种版面区域的宽度上限
28
+ xLabel: 版面区域
29
+ yLabel: 最大宽度
30
+ unit: px
31
+ data:
32
+ - x: 普通正文列
33
+ y: 740
34
+ - x: 宽幅配图区
35
+ y: 1040
36
+ - x: 多列宽表格
37
+ y: 1340
38
+ caption: 点击「查看数据表」可展开完整数值表格。
39
+ ```
40
+ ````
41
+
42
+ - **用**:对比 2~8 组同量纲数值的长短比例时。
43
+ - **别用**:已经在同一个小节里放了同组数字的 Markdown 表格时不要再画一张 `chart`(图表底部已自带可展开的数据表)。
44
+
45
+ | 字段 | 必填 | 类型 | 说明 |
46
+ | :--- | :--- | :--- | :--- |
47
+ | `title` | 建议 | 字符串 | 图表标题 |
48
+ | `data` | 是 | `{ x, y, label? }[]`(至少 2 项) | 数据行列表,`x` 为名称,`y` 为数值 |
49
+ | `unit` | 否 | 字符串 | 数值后缀单位(当数据项未单独指定 `label` 时自动拼接) |
50
+ | `xLabel` | 否 | 字符串 | 展开数据表第一列的表头名称(默认 `项目`) |
51
+ | `yLabel` | 否 | 字符串 | 展开数据表第二列的表头名称(默认 `数值`) |
52
+ | `caption` | 否 | 字符串 | 图表底部的图注说明 |
@@ -0,0 +1,40 @@
1
+ ---
2
+ title: 并排对比(compare)
3
+ navTitle: 并排对比
4
+ description: 把两到三种方案左右并列,对比各自的取舍与属性。
5
+ section: components
6
+ order: 33
7
+ badge: compare
8
+ ---
9
+
10
+ ```garden compare
11
+ items:
12
+ - title: 只贴一段 diff
13
+ text: 读者只看到增删行;前面没有完整代码块时,garden check 报 diff-orphan 错误。
14
+ 能否复制新版: 不能
15
+ - title: 完整代码 + 紧跟的 diff
16
+ text: 两段合成一个代码框,可在「代码」和「对比上一版」之间切换。
17
+ 能否复制新版: 两个标签下都复制新版
18
+ ```
19
+
20
+ ````markdown
21
+ ```garden compare
22
+ items:
23
+ - title: 只贴一段 diff
24
+ text: 读者只看到增删行;前面没有完整代码块时,garden check 报 diff-orphan 错误。
25
+ 能否复制新版: 不能
26
+ - title: 完整代码 + 紧跟的 diff
27
+ text: 两段合成一个代码框,可在「代码」和「对比上一版」之间切换。
28
+ 能否复制新版: 两个标签下都复制新版
29
+ ```
30
+ ````
31
+
32
+ - **用**:并排对比 2~3 种方案、配置方式或改动前后的行为差异时(每格文字控制在 60 字以内)。
33
+ - **别用**:对比项超过 3 个或需要横向对齐多个参数维度时,直接用 Markdown 表格。
34
+
35
+ | 字段 | 必填 | 类型 | 说明 |
36
+ | :--- | :--- | :--- | :--- |
37
+ | `items` | 是 | 数组(至少 2 项) | 对比项列表;每项也可简写为 `"标题:说明"` 单行字符串 |
38
+ | `items[].title` | 建议 | 字符串 | 该对比列的标题 |
39
+ | `items[].text` | 建议 | 字符串或字符串数组 | 该对比列的正文说明 |
40
+ | `items[].<自定义键>` | 否 | 字符串或数字 | 除 `title` / `text` 外的附加键值会渲染在卡片底部的属性标签行 |