@unana_dev/doxen 0.2.4 → 0.2.6
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/README.md +12 -26
- package/client/app.js +400 -0
- package/client/style.css +502 -43
- package/package.json +2 -1
- package/src/build.js +5 -2
- package/src/config.js +8 -3
- package/src/content.js +17 -2
- package/src/dev.js +1 -0
- package/src/index.d.ts +1 -0
package/README.md
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
> 저장소에 흩어진 Markdown 파일, 그대로 두고 **설정 파일 하나로** 검색 되는 문서 사이트를 만들어 봅시다.
|
|
4
4
|
> 필요하다면 **명령 하나로 우리 팀만 볼 수 있는 비공개 사이트**로 배포까지 할 수 있습니다.
|
|
5
5
|
|
|
6
|
-
---
|
|
7
|
-
|
|
8
6
|
## 목차
|
|
9
7
|
|
|
10
8
|
1. [Doxen이 뭔가요?](#doxen이-뭔가요)
|
|
@@ -21,8 +19,6 @@
|
|
|
21
19
|
12. [명령어 한눈에 보기](#명령어-한눈에-보기)
|
|
22
20
|
13. [Doxen에 기여하고 싶다면](#doxen에-기여하고-싶다면)
|
|
23
21
|
|
|
24
|
-
---
|
|
25
|
-
|
|
26
22
|
## Doxen이 뭔가요?
|
|
27
23
|
|
|
28
24
|
Doxen은 **이미 저장소에 있는 Markdown 폴더를 문서 사이트로 바꿔 주는 npm 패키지**입니다.
|
|
@@ -37,8 +33,6 @@ Doxen은 **이미 저장소에 있는 Markdown 폴더를 문서 사이트로 바
|
|
|
37
33
|
|
|
38
34
|
React나 Vue 같은 프레임워크를 프로젝트에 설치할 필요도 없습니다. 사이트를 그리는 코드는 전부 패키지 안에 들어 있어요.
|
|
39
35
|
|
|
40
|
-
---
|
|
41
|
-
|
|
42
36
|
## 시작 전 준비물
|
|
43
37
|
|
|
44
38
|
| 준비물 | 확인 방법 |
|
|
@@ -78,8 +72,6 @@ Doxen은 실행 명령을 두 가지 이름으로 제공합니다.
|
|
|
78
72
|
|
|
79
73
|
`docs`라는 이름은 흔해서 다른 의존성과 충돌할 수 있습니다. 그래서 `init`이 만들어 주는 스크립트는 **`doxen`을 사용**합니다. 헷갈리면 그냥 **항상 `doxen`을 쓰셔도 됩니다.**
|
|
80
74
|
|
|
81
|
-
---
|
|
82
|
-
|
|
83
75
|
## 2단계: 초기 설정 만들기 (init)
|
|
84
76
|
|
|
85
77
|
```bash
|
|
@@ -104,8 +96,6 @@ yarn doxen init
|
|
|
104
96
|
> 📁 **이미 문서 폴더가 있다면?**
|
|
105
97
|
> 설정 파일에서 경로만 기존 폴더로 바꿔 주고, 자동 생성된 시작 문서(`docs/README.md`)는 필요 없으면 지우면 됩니다.
|
|
106
98
|
|
|
107
|
-
---
|
|
108
|
-
|
|
109
99
|
## 3단계: 미리보기 띄우기 (dev)
|
|
110
100
|
|
|
111
101
|
```bash
|
|
@@ -126,8 +116,6 @@ npx doxen dev --port 4200
|
|
|
126
116
|
|
|
127
117
|
> ⚠️ 로컬 미리보기에는 로그인/인증이 적용되지 않습니다. 배포 후 보호는 7단계에서 다룹니다.
|
|
128
118
|
|
|
129
|
-
---
|
|
130
|
-
|
|
131
119
|
## 4단계: 설정 파일 이해하기
|
|
132
120
|
|
|
133
121
|
`docs.config.ts`를 열어 보면 대략 이런 모양입니다.
|
|
@@ -183,6 +171,16 @@ slug: '시작하기' // ❌ 한글
|
|
|
183
171
|
slug: 'my_docs' // ❌ 밑줄
|
|
184
172
|
```
|
|
185
173
|
|
|
174
|
+
### color: 사이트 강조색
|
|
175
|
+
|
|
176
|
+
`docs.config.ts`에서 색상 하나를 지정하면 활성 탭, 문서 탐색과 링크, 컴포넌트의 포커스·호버, 인라인 코드와 검색 하이라이팅에 적용됩니다. 배경과 테두리는 해당 색상의 밝은 톤으로 자동 생성합니다.
|
|
177
|
+
|
|
178
|
+
```ts
|
|
179
|
+
color: '#7e22ce',
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
`#fff` 또는 `#ffffff` 형식의 HEX 색상을 사용하세요. `icon`을 생략하면 로고와 파비콘에도 같은 색상을 적용합니다. `color` 없이 `icon: '#eab308'`처럼 단일 색상을 지정해도 사이트 강조색에 반영됩니다. 둘 다 지정하면 사이트 강조색은 `color`를 따르고, 로고와 파비콘은 `icon`을 따릅니다. `icon` 객체만 지정하거나 색상 설정을 생략하면 기존 사이트 테마를 유지합니다.
|
|
183
|
+
|
|
186
184
|
### icon: 로고와 파비콘 색상
|
|
187
185
|
|
|
188
186
|
상단 로고와 브라우저 탭 아이콘(파비콘)의 색을 정합니다. 두 가지 방법이 있어요.
|
|
@@ -220,15 +218,13 @@ guide/
|
|
|
220
218
|
└── 01-config.md
|
|
221
219
|
```
|
|
222
220
|
|
|
223
|
-
- 하위 폴더는 탐색 목록에 **경로 형태로** 표시됩니다.
|
|
221
|
+
- 하위 폴더는 탐색 목록에 **경로 형태로** 표시됩니다. 폴더의 `.xlsx` 파일도 목록에서 열어 시트별 셀 값을 확인하고 원본을 다운로드할 수 있습니다. 수식은 저장된 결과값을 표시하며 서식과 차트는 표시하지 않습니다.
|
|
224
222
|
- 숨김 파일(`.`으로 시작), `node_modules`, 심볼릭 링크 문서는 **제외**됩니다.
|
|
225
223
|
|
|
226
224
|
> ⚠️ **보안 메모**
|
|
227
225
|
> - 설정 파일은 Node에서 **실제로 실행되는 코드**입니다. 신뢰할 수 있는 저장소에서만 사용하세요.
|
|
228
226
|
> - 모든 탭은 **하나의 사이트에 함께** 들어갑니다. "이 탭은 A팀만 보기" 같은 탭별 권한은 없습니다.
|
|
229
227
|
|
|
230
|
-
---
|
|
231
|
-
|
|
232
228
|
## 5단계: 문서 작성 규칙
|
|
233
229
|
|
|
234
230
|
### 그대로 쓸 수 있는 것 ✅
|
|
@@ -238,7 +234,7 @@ guide/
|
|
|
238
234
|
- Mermaid 코드 블록(`mermaid`): 시퀀스·흐름도 등을 다이어그램으로 표시합니다. 언어 지정 없이 `sequenceDiagram`으로 시작하는 코드 블록도 지원합니다. 문법 오류가 있으면 안내와 원본 코드를 표시합니다.
|
|
239
235
|
- 다른 문서로의 상대 링크 (`[설치 방법](./02-installation.md)`)
|
|
240
236
|
- 한국어 제목 앵커 (`#설치-방법`)
|
|
241
|
-
-
|
|
237
|
+
- 이미지·파일 첨부: PNG / JPEG / GIF / WebP / AVIF / ICO / PDF / XLSX
|
|
242
238
|
|
|
243
239
|
### 지원하지 않는 것 ❌
|
|
244
240
|
|
|
@@ -298,8 +294,6 @@ guide/
|
|
|
298
294
|
- 결과 사이 이동: 이전/다음 버튼, **Enter / Shift+Enter**
|
|
299
295
|
- 형태소 분석이나 오타 교정은 **하지 않습니다.** ("설치했다"로 "설치"를 찾는 식의 검색은 안 되니, 짧은 핵심 단어로 검색하세요.)
|
|
300
296
|
|
|
301
|
-
---
|
|
302
|
-
|
|
303
297
|
## 6단계: 정적 사이트로 빌드하기
|
|
304
298
|
|
|
305
299
|
```bash
|
|
@@ -325,8 +319,6 @@ npx doxen build --config ./config/docs.config.ts
|
|
|
325
319
|
> ⚠️ **비공개 문서라면 주의!**
|
|
326
320
|
> 빌드 결과에는 문서 HTML과 **검색용 본문 전체**가 들어 있습니다. 원본이 비공개라면 결과물도 반드시 **비공개로** 배포하세요. 가장 쉬운 방법이 바로 다음 단계입니다.
|
|
327
321
|
|
|
328
|
-
---
|
|
329
|
-
|
|
330
322
|
## 7단계: 비공개 사이트로 배포하기 (Cloudflare)
|
|
331
323
|
|
|
332
324
|
사내 문서처럼 **허락된 사람만** 봐야 하는 경우, Doxen은 Cloudflare Pages + Cloudflare Access를 이용해 **명령 하나로** 비공개 배포를 해 줍니다.
|
|
@@ -540,8 +532,6 @@ CHOKIDAR_USEPOLLING=1 npm run docs:dev
|
|
|
540
532
|
**Q. 문서가 아주 많은데 괜찮을까요?**
|
|
541
533
|
사이트가 전체 문서 데이터를 한 번에 내려받는 구조라, 현재는 **소규모~중규모 팀 문서**에 맞춰져 있습니다. 대형 저장소는 성능을 미리 확인해 보세요.
|
|
542
534
|
|
|
543
|
-
---
|
|
544
|
-
|
|
545
535
|
## 명령어 한눈에 보기
|
|
546
536
|
|
|
547
537
|
| 하고 싶은 일 | 명령 |
|
|
@@ -554,8 +544,6 @@ CHOKIDAR_USEPOLLING=1 npm run docs:dev
|
|
|
554
544
|
| 다른 설정 파일 사용 | `--config ./config/docs.config.ts` (dev, build, deploy, ai 공통) |
|
|
555
545
|
| AI 작업 지침 생성 | `npx doxen ai --file <문서> --instruction "<요청>"` |
|
|
556
546
|
|
|
557
|
-
---
|
|
558
|
-
|
|
559
547
|
## Doxen에 기여하고 싶다면
|
|
560
548
|
|
|
561
549
|
패키지 자체를 개발하거나 검증하려면 Doxen 저장소에서 다음 명령을 사용합니다.
|
|
@@ -577,6 +565,4 @@ npm pack
|
|
|
577
565
|
|
|
578
566
|
**구조 한 줄 요약:** `bin/docs.js` → 설정 로더 → Markdown·섹션·첨부 처리 → 정적 빌드 또는 로컬 서버. 화면과 브라우저 검색 코드는 `client/`에 있습니다.
|
|
579
567
|
|
|
580
|
-
---
|
|
581
|
-
|
|
582
568
|
궁금한 점이나 버그는 저장소 이슈로 남겨 주세요. 즐거운 문서 작성 되세요! 📚
|
package/client/app.js
CHANGED
|
@@ -189,6 +189,397 @@ function renderFolder(folderPath) {
|
|
|
189
189
|
window.scrollTo(0, 0);
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
+
const columnLetter = (index) => {
|
|
193
|
+
let name = "";
|
|
194
|
+
for (let n = index + 1; n > 0; n = Math.floor((n - 1) / 26))
|
|
195
|
+
name = String.fromCharCode(65 + ((n - 1) % 26)) + name;
|
|
196
|
+
return name;
|
|
197
|
+
};
|
|
198
|
+
const ROW_HEAD = 46;
|
|
199
|
+
const COL_HEAD = 26;
|
|
200
|
+
|
|
201
|
+
function prepareSheet(sheet) {
|
|
202
|
+
const source = Array.isArray(sheet.data) ? sheet.data : [];
|
|
203
|
+
const columns = Math.max(1, ...source.map((row) => row.length));
|
|
204
|
+
const rows = (source.length ? source : [[]]).map((row) =>
|
|
205
|
+
Array.from({ length: columns }, (_, c) => row[c] ?? null),
|
|
206
|
+
);
|
|
207
|
+
const widths = Array.from({ length: columns }, (_, c) => {
|
|
208
|
+
let longest = 0;
|
|
209
|
+
for (const row of rows.slice(0, 200)) {
|
|
210
|
+
for (const line of String(row[c] ?? "").split("\n")) {
|
|
211
|
+
let width = 0;
|
|
212
|
+
for (const char of line) width += /[\u1100-\u11ff\u2e80-\ua4cf\uac00-\ud7af\uf900-\ufaff\uff00-\uffef]/.test(char) ? 14 : 8;
|
|
213
|
+
longest = Math.max(longest, width);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return Math.min(340, Math.max(72, longest + 24));
|
|
217
|
+
});
|
|
218
|
+
return { name: String(sheet.sheet ?? ""), rows, widths };
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function spreadsheetViewer(doc, rawSheets) {
|
|
222
|
+
const sheets = (rawSheets.length ? rawSheets : [{ sheet: "Sheet1", data: [] }]).map(prepareSheet);
|
|
223
|
+
const selection = sheets.map((sheet) => ({ r: sheet.rows.length > 1 ? 1 : 0, c: 0 }));
|
|
224
|
+
const state = { sheet: 0, wrap: false, full: false, query: "", matches: [], matchIndex: -1, expanded: null };
|
|
225
|
+
const button = (text, className, title) => {
|
|
226
|
+
const node = el("button", text, className);
|
|
227
|
+
node.type = "button";
|
|
228
|
+
if (title) node.title = title;
|
|
229
|
+
return node;
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
const viewer = el("div", undefined, "sheet-viewer");
|
|
233
|
+
const toolbar = el("div", undefined, "sheet-toolbar");
|
|
234
|
+
const finder = el("label", undefined, "sheet-find");
|
|
235
|
+
const findInput = el("input");
|
|
236
|
+
findInput.type = "search";
|
|
237
|
+
findInput.placeholder = "시트에서 찾기 (Enter: 다음)";
|
|
238
|
+
findInput.setAttribute("aria-label", "시트에서 찾기");
|
|
239
|
+
const matchLabel = el("span", "", "sheet-find-count");
|
|
240
|
+
matchLabel.setAttribute("aria-live", "polite");
|
|
241
|
+
finder.append(el("span", undefined, "sheet-find-icon"), findInput, matchLabel);
|
|
242
|
+
const wrapButton = button("텍스트 줄바꿈", "sheet-button");
|
|
243
|
+
wrapButton.setAttribute("aria-pressed", "false");
|
|
244
|
+
const fullButton = button(undefined, "sheet-full-button", "펼치기");
|
|
245
|
+
fullButton.setAttribute("aria-label", "펼치기");
|
|
246
|
+
fullButton.setAttribute("aria-pressed", "false");
|
|
247
|
+
fullButton.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 3h7v7M21 3l-7 7M10 21H3v-7M3 21l7-7"/></svg>';
|
|
248
|
+
const download = el("a", "다운로드", "sheet-download");
|
|
249
|
+
download.href = doc.spreadsheet.file;
|
|
250
|
+
download.download = doc.title;
|
|
251
|
+
download.setAttribute("aria-label", "엑셀 파일 다운로드");
|
|
252
|
+
toolbar.append(fullButton, finder, el("span", undefined, "sheet-spacer"), wrapButton, download);
|
|
253
|
+
|
|
254
|
+
const formula = el("div", undefined, "sheet-formula");
|
|
255
|
+
const nameBox = el("div", "", "sheet-name-box");
|
|
256
|
+
const formulaValue = el("div", "", "sheet-formula-value");
|
|
257
|
+
formula.append(nameBox, el("div", "fx", "sheet-fx"), formulaValue);
|
|
258
|
+
|
|
259
|
+
const grid = el("div", undefined, "sheet-grid spreadsheet-table");
|
|
260
|
+
grid.tabIndex = 0;
|
|
261
|
+
grid.setAttribute("role", "grid");
|
|
262
|
+
grid.setAttribute("aria-label", `${doc.title} 시트`);
|
|
263
|
+
|
|
264
|
+
const footer = el("div", undefined, "sheet-footer");
|
|
265
|
+
const arrows = el("div", undefined, "sheet-arrows");
|
|
266
|
+
const prev = button("‹", "sheet-arrow", "이전 시트 (Ctrl+PgUp)");
|
|
267
|
+
const next = button("›", "sheet-arrow", "다음 시트 (Ctrl+PgDn)");
|
|
268
|
+
prev.setAttribute("aria-label", "이전 시트");
|
|
269
|
+
next.setAttribute("aria-label", "다음 시트");
|
|
270
|
+
arrows.append(prev, next);
|
|
271
|
+
const tabs = el("div", undefined, "sheet-tabs");
|
|
272
|
+
tabs.setAttribute("role", "tablist");
|
|
273
|
+
tabs.setAttribute("aria-label", "시트 선택");
|
|
274
|
+
const status = el("div", undefined, "sheet-status");
|
|
275
|
+
const statusMessage = el("span", "");
|
|
276
|
+
statusMessage.setAttribute("aria-live", "polite");
|
|
277
|
+
const dims = el("span", "");
|
|
278
|
+
status.append(statusMessage, dims);
|
|
279
|
+
footer.append(arrows, tabs, status);
|
|
280
|
+
viewer.append(toolbar, formula, grid, footer);
|
|
281
|
+
|
|
282
|
+
const tabButtons = sheets.map((sheet, i) => {
|
|
283
|
+
const tab = button(undefined, "sheet-tab");
|
|
284
|
+
tab.setAttribute("role", "tab");
|
|
285
|
+
tab.append(el("span", sheet.name), el("span", String(Math.max(0, sheet.rows.length - 1)), "sheet-tab-count"));
|
|
286
|
+
tab.onclick = () => goSheet(i);
|
|
287
|
+
tabs.append(tab);
|
|
288
|
+
return tab;
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
let cells = [];
|
|
292
|
+
let colHeads = [];
|
|
293
|
+
let rowHeads = [];
|
|
294
|
+
let cols = [];
|
|
295
|
+
let table;
|
|
296
|
+
|
|
297
|
+
const cellValue = (r, c) => {
|
|
298
|
+
const value = sheets[state.sheet].rows[r]?.[c];
|
|
299
|
+
return value == null ? "" : String(value);
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
function updateFormula() {
|
|
303
|
+
const { r, c } = selection[state.sheet];
|
|
304
|
+
nameBox.textContent = `${columnLetter(c)}${r + 1}`;
|
|
305
|
+
formulaValue.textContent = cellValue(r, c) || " ";
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function scrollToCell({ r, c }) {
|
|
309
|
+
const cell = cells[r]?.[c];
|
|
310
|
+
if (!cell) return;
|
|
311
|
+
const top = COL_HEAD + (r > 0 ? cells[0][0].offsetHeight : 0);
|
|
312
|
+
if (cell.offsetLeft - ROW_HEAD < grid.scrollLeft) grid.scrollLeft = cell.offsetLeft - ROW_HEAD;
|
|
313
|
+
else if (cell.offsetLeft + cell.offsetWidth > grid.scrollLeft + grid.clientWidth)
|
|
314
|
+
grid.scrollLeft = cell.offsetLeft + cell.offsetWidth - grid.clientWidth;
|
|
315
|
+
if (r === 0) return;
|
|
316
|
+
if (cell.offsetTop - top < grid.scrollTop) grid.scrollTop = cell.offsetTop - top;
|
|
317
|
+
else if (cell.offsetTop + cell.offsetHeight > grid.scrollTop + grid.clientHeight)
|
|
318
|
+
grid.scrollTop = cell.offsetTop + cell.offsetHeight - grid.clientHeight;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function mark(on) {
|
|
322
|
+
const { r, c } = selection[state.sheet];
|
|
323
|
+
cells[r]?.[c]?.classList.toggle("is-selected", on);
|
|
324
|
+
cells[r]?.[c]?.setAttribute("aria-selected", String(on));
|
|
325
|
+
colHeads[c]?.classList.toggle("is-active", on);
|
|
326
|
+
rowHeads[r]?.classList.toggle("is-active", on);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function select(r, c, { scroll = true } = {}) {
|
|
330
|
+
mark(false);
|
|
331
|
+
if (state.expanded) {
|
|
332
|
+
cells[state.expanded.r]?.[state.expanded.c]?.classList.remove("is-expanded");
|
|
333
|
+
state.expanded = null;
|
|
334
|
+
}
|
|
335
|
+
selection[state.sheet] = { r, c };
|
|
336
|
+
mark(true);
|
|
337
|
+
statusMessage.textContent = "";
|
|
338
|
+
updateFormula();
|
|
339
|
+
if (scroll) scrollToCell({ r, c });
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
function paintMatches() {
|
|
343
|
+
for (const row of cells) for (const cell of row) cell.classList.remove("is-match", "is-current-match");
|
|
344
|
+
const query = state.query.trim().toLocaleLowerCase();
|
|
345
|
+
state.matches = [];
|
|
346
|
+
if (query) {
|
|
347
|
+
for (const [r, row] of sheets[state.sheet].rows.entries())
|
|
348
|
+
for (const [c, value] of row.entries())
|
|
349
|
+
if (String(value ?? "").toLocaleLowerCase().includes(query)) {
|
|
350
|
+
state.matches.push({ r, c });
|
|
351
|
+
cells[r][c].classList.add("is-match");
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
const current = state.matches[state.matchIndex];
|
|
355
|
+
if (current) cells[current.r][current.c].classList.add("is-current-match");
|
|
356
|
+
matchLabel.textContent = query
|
|
357
|
+
? state.matches.length
|
|
358
|
+
? `${state.matchIndex >= 0 ? state.matchIndex + 1 : 0}/${state.matches.length}`
|
|
359
|
+
: "0건"
|
|
360
|
+
: "";
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
function buildGrid() {
|
|
364
|
+
const sheet = sheets[state.sheet];
|
|
365
|
+
table = el("table");
|
|
366
|
+
const colgroup = el("colgroup");
|
|
367
|
+
colgroup.append(Object.assign(el("col"), { style: `width:${ROW_HEAD}px` }));
|
|
368
|
+
cols = sheet.widths.map((width) => {
|
|
369
|
+
const col = el("col");
|
|
370
|
+
col.style.width = `${width}px`;
|
|
371
|
+
colgroup.append(col);
|
|
372
|
+
return col;
|
|
373
|
+
});
|
|
374
|
+
const head = el("thead");
|
|
375
|
+
const headRow = el("tr");
|
|
376
|
+
headRow.append(el("th", "", "sheet-corner"));
|
|
377
|
+
colHeads = sheet.widths.map((_, c) => {
|
|
378
|
+
const th = el("th", columnLetter(c), "sheet-col-head");
|
|
379
|
+
th.scope = "col";
|
|
380
|
+
const handle = el("span", undefined, "sheet-resize");
|
|
381
|
+
handle.setAttribute("aria-hidden", "true");
|
|
382
|
+
handle.onpointerdown = (event) => startResize(event, c);
|
|
383
|
+
th.append(handle);
|
|
384
|
+
headRow.append(th);
|
|
385
|
+
return th;
|
|
386
|
+
});
|
|
387
|
+
head.append(headRow);
|
|
388
|
+
const body = el("tbody");
|
|
389
|
+
rowHeads = [];
|
|
390
|
+
cells = sheet.rows.map((row, r) => {
|
|
391
|
+
const tr = el("tr");
|
|
392
|
+
const number = el("th", String(r + 1), "sheet-row-head");
|
|
393
|
+
number.scope = "row";
|
|
394
|
+
rowHeads.push(number);
|
|
395
|
+
tr.append(number);
|
|
396
|
+
const rowCells = row.map((value, c) => {
|
|
397
|
+
const td = el("td");
|
|
398
|
+
td.dataset.cell = `${r}-${c}`;
|
|
399
|
+
td.setAttribute("role", "gridcell");
|
|
400
|
+
if (typeof value === "number") td.classList.add("is-number");
|
|
401
|
+
td.append(el("div", value == null ? "" : String(value)));
|
|
402
|
+
tr.append(td);
|
|
403
|
+
return td;
|
|
404
|
+
});
|
|
405
|
+
if (r === 0) tr.classList.add("sheet-header-row");
|
|
406
|
+
body.append(tr);
|
|
407
|
+
return rowCells;
|
|
408
|
+
});
|
|
409
|
+
table.append(colgroup, head, body);
|
|
410
|
+
updateWidth();
|
|
411
|
+
grid.replaceChildren(table);
|
|
412
|
+
grid.scrollTop = 0;
|
|
413
|
+
grid.scrollLeft = 0;
|
|
414
|
+
mark(true);
|
|
415
|
+
updateFormula();
|
|
416
|
+
paintMatches();
|
|
417
|
+
dims.textContent = `${Math.max(0, sheet.rows.length - 1)}행 × ${sheet.widths.length}열`;
|
|
418
|
+
for (const [i, tab] of tabButtons.entries()) {
|
|
419
|
+
tab.classList.toggle("is-active", i === state.sheet);
|
|
420
|
+
tab.setAttribute("aria-selected", String(i === state.sheet));
|
|
421
|
+
}
|
|
422
|
+
tabButtons[state.sheet]?.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function updateWidth() {
|
|
426
|
+
table.style.width = `${ROW_HEAD + sheets[state.sheet].widths.reduce((a, b) => a + b, 0)}px`;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
function startResize(event, c) {
|
|
430
|
+
event.preventDefault();
|
|
431
|
+
event.stopPropagation();
|
|
432
|
+
const widths = sheets[state.sheet].widths;
|
|
433
|
+
const x0 = event.clientX;
|
|
434
|
+
const w0 = widths[c];
|
|
435
|
+
const move = (moveEvent) => {
|
|
436
|
+
widths[c] = Math.max(40, Math.round(w0 + moveEvent.clientX - x0));
|
|
437
|
+
cols[c].style.width = `${widths[c]}px`;
|
|
438
|
+
updateWidth();
|
|
439
|
+
};
|
|
440
|
+
const up = () => {
|
|
441
|
+
window.removeEventListener("pointermove", move);
|
|
442
|
+
window.removeEventListener("pointerup", up);
|
|
443
|
+
viewer.classList.remove("is-resizing");
|
|
444
|
+
};
|
|
445
|
+
viewer.classList.add("is-resizing");
|
|
446
|
+
window.addEventListener("pointermove", move);
|
|
447
|
+
window.addEventListener("pointerup", up);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
function goSheet(index) {
|
|
451
|
+
state.sheet = (index + sheets.length) % sheets.length;
|
|
452
|
+
state.matchIndex = -1;
|
|
453
|
+
state.expanded = null;
|
|
454
|
+
statusMessage.textContent = "";
|
|
455
|
+
buildGrid();
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
function setFull(full) {
|
|
459
|
+
state.full = full;
|
|
460
|
+
viewer.classList.toggle("is-full", full);
|
|
461
|
+
document.body.classList.toggle("sheet-fullscreen", full);
|
|
462
|
+
const label = full ? "좁히기" : "펼치기";
|
|
463
|
+
fullButton.title = label;
|
|
464
|
+
fullButton.setAttribute("aria-label", label);
|
|
465
|
+
fullButton.querySelector("path").setAttribute("d", full
|
|
466
|
+
? "M14 4v6h6M14 10l7-7M10 20v-6H4M10 14l-7 7"
|
|
467
|
+
: "M14 3h7v7M21 3l-7 7M10 21H3v-7M3 21l7-7");
|
|
468
|
+
fullButton.setAttribute("aria-pressed", String(full));
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
grid.addEventListener("pointerdown", (event) => {
|
|
472
|
+
const cell = event.target.closest("td[data-cell]");
|
|
473
|
+
if (!cell) return;
|
|
474
|
+
const [r, c] = cell.dataset.cell.split("-").map(Number);
|
|
475
|
+
select(r, c, { scroll: false });
|
|
476
|
+
setTimeout(() => grid.focus({ preventScroll: true }));
|
|
477
|
+
});
|
|
478
|
+
grid.addEventListener("dblclick", (event) => {
|
|
479
|
+
const cell = event.target.closest("td[data-cell]");
|
|
480
|
+
if (!cell) return;
|
|
481
|
+
const [r, c] = cell.dataset.cell.split("-").map(Number);
|
|
482
|
+
const same = state.expanded?.r === r && state.expanded?.c === c;
|
|
483
|
+
if (state.expanded) cells[state.expanded.r][state.expanded.c].classList.remove("is-expanded");
|
|
484
|
+
state.expanded = same ? null : { r, c };
|
|
485
|
+
cell.classList.toggle("is-expanded", !same);
|
|
486
|
+
});
|
|
487
|
+
grid.addEventListener("keydown", (event) => {
|
|
488
|
+
const rows = sheets[state.sheet].rows;
|
|
489
|
+
const { r, c } = selection[state.sheet];
|
|
490
|
+
const lastRow = rows.length - 1;
|
|
491
|
+
const lastCol = rows[0].length - 1;
|
|
492
|
+
const mod = event.metaKey || event.ctrlKey;
|
|
493
|
+
if (mod && (event.key === "PageUp" || event.key === "PageDown")) {
|
|
494
|
+
event.preventDefault();
|
|
495
|
+
goSheet(state.sheet + (event.key === "PageUp" ? -1 : 1));
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
if (mod && event.key.toLowerCase() === "c" && !getSelection()?.toString()) {
|
|
499
|
+
event.preventDefault();
|
|
500
|
+
navigator.clipboard?.writeText(cellValue(r, c)).then(
|
|
501
|
+
() => (statusMessage.textContent = `${columnLetter(c)}${r + 1} 복사됨`),
|
|
502
|
+
() => (statusMessage.textContent = "복사하지 못했습니다"),
|
|
503
|
+
);
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
if (event.key === "Escape" && state.full) {
|
|
507
|
+
event.preventDefault();
|
|
508
|
+
setFull(false);
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
const move = {
|
|
512
|
+
ArrowUp: [-1, 0],
|
|
513
|
+
ArrowDown: [1, 0],
|
|
514
|
+
ArrowLeft: [0, -1],
|
|
515
|
+
ArrowRight: [0, 1],
|
|
516
|
+
Enter: [event.shiftKey ? -1 : 1, 0],
|
|
517
|
+
Tab: [0, event.shiftKey ? -1 : 1],
|
|
518
|
+
}[event.key];
|
|
519
|
+
const clamp = (value, max) => Math.min(max, Math.max(0, value));
|
|
520
|
+
if (move) {
|
|
521
|
+
event.preventDefault();
|
|
522
|
+
const nr = mod && move[0] ? (move[0] > 0 ? lastRow : 0) : clamp(r + move[0], lastRow);
|
|
523
|
+
const nc = mod && move[1] ? (move[1] > 0 ? lastCol : 0) : clamp(c + move[1], lastCol);
|
|
524
|
+
select(nr, nc);
|
|
525
|
+
} else if (event.key === "Home") {
|
|
526
|
+
event.preventDefault();
|
|
527
|
+
select(mod ? 0 : r, 0);
|
|
528
|
+
} else if (event.key === "End") {
|
|
529
|
+
event.preventDefault();
|
|
530
|
+
select(mod ? lastRow : r, lastCol);
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
findInput.addEventListener("input", () => {
|
|
534
|
+
state.query = findInput.value;
|
|
535
|
+
state.matchIndex = -1;
|
|
536
|
+
paintMatches();
|
|
537
|
+
});
|
|
538
|
+
findInput.addEventListener("keydown", (event) => {
|
|
539
|
+
if (event.key === "Escape" && state.full) return setFull(false);
|
|
540
|
+
if (event.key !== "Enter" || !state.matches.length) return;
|
|
541
|
+
event.preventDefault();
|
|
542
|
+
const count = state.matches.length;
|
|
543
|
+
state.matchIndex = (state.matchIndex + (event.shiftKey ? -1 : 1) + count) % count;
|
|
544
|
+
paintMatches();
|
|
545
|
+
const { r, c } = state.matches[state.matchIndex];
|
|
546
|
+
select(r, c);
|
|
547
|
+
});
|
|
548
|
+
wrapButton.onclick = () => {
|
|
549
|
+
state.wrap = !state.wrap;
|
|
550
|
+
viewer.classList.toggle("is-wrapped", state.wrap);
|
|
551
|
+
wrapButton.setAttribute("aria-pressed", String(state.wrap));
|
|
552
|
+
};
|
|
553
|
+
fullButton.onclick = () => setFull(!state.full);
|
|
554
|
+
prev.onclick = () => goSheet(state.sheet - 1);
|
|
555
|
+
next.onclick = () => goSheet(state.sheet + 1);
|
|
556
|
+
|
|
557
|
+
buildGrid();
|
|
558
|
+
return viewer;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
async function renderSpreadsheet(doc) {
|
|
562
|
+
const article = $("#article");
|
|
563
|
+
const content = el("p", "엑셀 파일을 불러오는 중입니다.", "sheet-message");
|
|
564
|
+
article.replaceChildren(el("h1", doc.title), content);
|
|
565
|
+
try {
|
|
566
|
+
const response = await fetch(doc.spreadsheet.data);
|
|
567
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
568
|
+
const sheets = await response.json();
|
|
569
|
+
if (current !== doc) return;
|
|
570
|
+
content.replaceWith(
|
|
571
|
+
spreadsheetViewer(doc, sheets),
|
|
572
|
+
el(
|
|
573
|
+
"p",
|
|
574
|
+
"방향키로 셀 이동 · 더블클릭 또는 줄바꿈으로 전체 내용 보기 · 열 경계 드래그로 너비 조절 · Ctrl+C 셀 복사",
|
|
575
|
+
"sheet-hint",
|
|
576
|
+
),
|
|
577
|
+
);
|
|
578
|
+
} catch {
|
|
579
|
+
if (current === doc) content.textContent = "엑셀 파일을 불러오지 못했습니다.";
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
|
|
192
583
|
function render() {
|
|
193
584
|
let id, anchor;
|
|
194
585
|
try {
|
|
@@ -209,6 +600,8 @@ function render() {
|
|
|
209
600
|
const isFolder = folderPath && site.documents.some(
|
|
210
601
|
(doc) => doc.tab === activeTab && doc.path.startsWith(folderPath),
|
|
211
602
|
);
|
|
603
|
+
document.body.classList.toggle("is-spreadsheet", Boolean(current?.spreadsheet));
|
|
604
|
+
document.body.classList.remove("sheet-fullscreen");
|
|
212
605
|
renderNavigation(isFolder ? folderPath : null);
|
|
213
606
|
$("#toc").replaceChildren();
|
|
214
607
|
$("#pagination").replaceChildren();
|
|
@@ -239,6 +632,13 @@ function render() {
|
|
|
239
632
|
title: current.path.split("/").at(-1).replace(/\.md$/i, ""),
|
|
240
633
|
id: current.id,
|
|
241
634
|
});
|
|
635
|
+
if (current.spreadsheet) {
|
|
636
|
+
$(".toc").hidden = true;
|
|
637
|
+
$("#pagination").hidden = true;
|
|
638
|
+
renderSpreadsheet(current);
|
|
639
|
+
window.scrollTo(0, 0);
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
242
642
|
$("#article").innerHTML = current.html;
|
|
243
643
|
if (!$("#article h1")) $("#article").prepend(el("h1", current.title));
|
|
244
644
|
for (const heading of $("#article").querySelectorAll("h2, h3, h4, h5, h6")) {
|
package/client/style.css
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
line-height: 1.5;
|
|
7
7
|
--line: #e1e6eb;
|
|
8
8
|
--muted: #818891;
|
|
9
|
-
--blue: #009dff;
|
|
10
9
|
}
|
|
11
10
|
* {
|
|
12
11
|
box-sizing: border-box;
|
|
@@ -15,7 +14,7 @@ body {
|
|
|
15
14
|
margin: 0;
|
|
16
15
|
}
|
|
17
16
|
a {
|
|
18
|
-
color: var(--
|
|
17
|
+
color: var(--accent, #009dff);
|
|
19
18
|
text-decoration: none;
|
|
20
19
|
}
|
|
21
20
|
a:hover {
|
|
@@ -52,7 +51,7 @@ input:focus-visible,
|
|
|
52
51
|
button:focus-visible,
|
|
53
52
|
a:focus-visible,
|
|
54
53
|
summary:focus-visible {
|
|
55
|
-
outline: 2px solid #76caff;
|
|
54
|
+
outline: 2px solid var(--accent-border, #76caff);
|
|
56
55
|
outline-offset: 3px;
|
|
57
56
|
}
|
|
58
57
|
header {
|
|
@@ -123,8 +122,8 @@ kbd {
|
|
|
123
122
|
border-bottom: 2px solid transparent;
|
|
124
123
|
}
|
|
125
124
|
#tabs a.active {
|
|
126
|
-
color: var(--
|
|
127
|
-
border-color: var(--
|
|
125
|
+
color: var(--accent, #009dff);
|
|
126
|
+
border-color: var(--accent, #009dff);
|
|
128
127
|
}
|
|
129
128
|
.layout {
|
|
130
129
|
display: grid;
|
|
@@ -161,8 +160,8 @@ kbd {
|
|
|
161
160
|
overflow-wrap: anywhere;
|
|
162
161
|
}
|
|
163
162
|
#documents a.selected {
|
|
164
|
-
color: var(--
|
|
165
|
-
border-left-color: var(--
|
|
163
|
+
color: var(--accent, #009dff);
|
|
164
|
+
border-left-color: var(--accent, #009dff);
|
|
166
165
|
}
|
|
167
166
|
.folder-group summary {
|
|
168
167
|
list-style: none;
|
|
@@ -240,22 +239,22 @@ main {
|
|
|
240
239
|
}
|
|
241
240
|
#breadcrumb a {
|
|
242
241
|
min-width: 0;
|
|
243
|
-
color: #1890ff;
|
|
242
|
+
color: var(--accent, #1890ff);
|
|
244
243
|
}
|
|
245
244
|
article {
|
|
246
245
|
font-size: 16px;
|
|
247
|
-
line-height: 1.
|
|
246
|
+
line-height: 1.625;
|
|
248
247
|
font-weight: 400;
|
|
249
|
-
letter-spacing:
|
|
248
|
+
letter-spacing: normal;
|
|
249
|
+
color: #1c1d1e;
|
|
250
250
|
overflow-wrap: anywhere;
|
|
251
251
|
}
|
|
252
252
|
article h1 {
|
|
253
|
-
font-size:
|
|
254
|
-
letter-spacing: -0.
|
|
255
|
-
line-height: 1.
|
|
256
|
-
margin:
|
|
257
|
-
|
|
258
|
-
font-weight: 650;
|
|
253
|
+
font-size: 36px;
|
|
254
|
+
letter-spacing: -0.025em;
|
|
255
|
+
line-height: 1.25;
|
|
256
|
+
margin: 0 0 24px;
|
|
257
|
+
font-weight: 700;
|
|
259
258
|
}
|
|
260
259
|
article strong {
|
|
261
260
|
font-weight: 600;
|
|
@@ -286,8 +285,8 @@ article strong {
|
|
|
286
285
|
transform: rotate(45deg);
|
|
287
286
|
}
|
|
288
287
|
.folder-cards a:hover {
|
|
289
|
-
background: #f7f9fa;
|
|
290
|
-
border-color: #c6d1dc;
|
|
288
|
+
background: var(--accent-soft, #f7f9fa);
|
|
289
|
+
border-color: var(--accent-border, #c6d1dc);
|
|
291
290
|
text-decoration: none;
|
|
292
291
|
}
|
|
293
292
|
.toc[hidden],
|
|
@@ -295,17 +294,28 @@ article strong {
|
|
|
295
294
|
display: none;
|
|
296
295
|
}
|
|
297
296
|
article h2 {
|
|
298
|
-
font-size:
|
|
299
|
-
letter-spacing: -0.
|
|
300
|
-
margin:
|
|
301
|
-
|
|
302
|
-
|
|
297
|
+
font-size: 30px;
|
|
298
|
+
letter-spacing: -0.0125em;
|
|
299
|
+
margin: 20px 0;
|
|
300
|
+
padding-top: 1em;
|
|
301
|
+
line-height: 1.2;
|
|
302
|
+
font-weight: 600;
|
|
303
303
|
}
|
|
304
304
|
article h3 {
|
|
305
|
+
font-size: 24px;
|
|
306
|
+
letter-spacing: -0.0125em;
|
|
307
|
+
line-height: 1.333333;
|
|
308
|
+
font-weight: 600;
|
|
309
|
+
margin: 20px 0;
|
|
310
|
+
padding-top: 0.75em;
|
|
311
|
+
}
|
|
312
|
+
article h4 {
|
|
305
313
|
font-size: 20px;
|
|
306
|
-
|
|
314
|
+
letter-spacing: -0.0125em;
|
|
315
|
+
line-height: 1.4;
|
|
307
316
|
font-weight: 600;
|
|
308
|
-
margin:
|
|
317
|
+
margin: 20px 0;
|
|
318
|
+
padding-top: 0.5em;
|
|
309
319
|
}
|
|
310
320
|
article :is(h1, h2, h3, h4, h5, h6) {
|
|
311
321
|
scroll-margin-top: 24px;
|
|
@@ -315,7 +325,7 @@ article .document-version {
|
|
|
315
325
|
padding: 10px 16px;
|
|
316
326
|
border: 1px solid var(--line);
|
|
317
327
|
border-radius: 12px;
|
|
318
|
-
background: #f7f9fa;
|
|
328
|
+
background: var(--accent-soft, #f7f9fa);
|
|
319
329
|
color: #b45309;
|
|
320
330
|
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
|
|
321
331
|
font-size: 14px;
|
|
@@ -327,32 +337,62 @@ article hr:has(+ .document-version) {
|
|
|
327
337
|
display: none;
|
|
328
338
|
}
|
|
329
339
|
article p {
|
|
330
|
-
|
|
331
|
-
margin: 16px 0;
|
|
340
|
+
margin: 20px 0;
|
|
332
341
|
}
|
|
333
342
|
article blockquote {
|
|
334
343
|
margin: 20px 0;
|
|
335
344
|
padding: 12px 24px;
|
|
336
|
-
border-left: 2px solid #d6dfe6;
|
|
337
|
-
color: #
|
|
345
|
+
border-left: 2px solid var(--accent-border, #d6dfe6);
|
|
346
|
+
color: #686f74;
|
|
338
347
|
}
|
|
339
348
|
article blockquote p {
|
|
340
349
|
margin: 0;
|
|
341
|
-
|
|
350
|
+
}
|
|
351
|
+
article blockquote > * + * {
|
|
352
|
+
margin-top: 16px;
|
|
342
353
|
}
|
|
343
354
|
article hr {
|
|
344
355
|
border: 0;
|
|
345
356
|
border-top: 1px solid var(--line);
|
|
346
|
-
margin: 20px 0
|
|
357
|
+
margin: 20px 0;
|
|
347
358
|
}
|
|
348
359
|
article ul,
|
|
349
360
|
article ol {
|
|
350
361
|
padding-left: 24px;
|
|
351
|
-
|
|
362
|
+
margin: 20px 0;
|
|
363
|
+
}
|
|
364
|
+
article li {
|
|
365
|
+
padding-left: 4px;
|
|
366
|
+
line-height: 1.5;
|
|
367
|
+
}
|
|
368
|
+
article li::marker {
|
|
369
|
+
color: #686f74;
|
|
352
370
|
}
|
|
353
371
|
article li + li {
|
|
354
372
|
margin-top: 8px;
|
|
355
373
|
}
|
|
374
|
+
article li > p {
|
|
375
|
+
margin: 0;
|
|
376
|
+
}
|
|
377
|
+
article li > :is(ul, ol) {
|
|
378
|
+
margin: 8px 0 0;
|
|
379
|
+
}
|
|
380
|
+
article li > :not(:first-child) {
|
|
381
|
+
margin-top: 8px;
|
|
382
|
+
}
|
|
383
|
+
article ul {
|
|
384
|
+
list-style-type: disc;
|
|
385
|
+
}
|
|
386
|
+
article ul ul {
|
|
387
|
+
list-style-type: circle;
|
|
388
|
+
}
|
|
389
|
+
article ol ol {
|
|
390
|
+
list-style-type: lower-alpha;
|
|
391
|
+
}
|
|
392
|
+
article a:not(.folder-cards a) {
|
|
393
|
+
text-decoration: underline;
|
|
394
|
+
text-underline-offset: 2px;
|
|
395
|
+
}
|
|
356
396
|
article pre {
|
|
357
397
|
overflow: auto;
|
|
358
398
|
padding: 18px;
|
|
@@ -363,8 +403,8 @@ article pre {
|
|
|
363
403
|
article code {
|
|
364
404
|
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
|
|
365
405
|
font-size: 12px;
|
|
366
|
-
background: #f4f7f9;
|
|
367
|
-
border: 1px solid #d8e0e7;
|
|
406
|
+
background: var(--accent-soft, #f4f7f9);
|
|
407
|
+
border: 1px solid var(--accent-border, #d8e0e7);
|
|
368
408
|
border-radius: 3px;
|
|
369
409
|
padding: 1px 4px;
|
|
370
410
|
color: #39414a;
|
|
@@ -374,6 +414,417 @@ article pre code {
|
|
|
374
414
|
border: 0;
|
|
375
415
|
background: none;
|
|
376
416
|
}
|
|
417
|
+
@media (min-width: 1201px) {
|
|
418
|
+
body.is-spreadsheet .layout {
|
|
419
|
+
grid-template-columns: 288px minmax(0, 1fr);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
body.is-spreadsheet .toc {
|
|
423
|
+
display: none;
|
|
424
|
+
}
|
|
425
|
+
body.sheet-fullscreen {
|
|
426
|
+
overflow: hidden;
|
|
427
|
+
}
|
|
428
|
+
.sheet-viewer {
|
|
429
|
+
--sheet-accent: var(--accent, #009dff);
|
|
430
|
+
--sheet-soft: color-mix(in srgb, var(--sheet-accent) 7%, white);
|
|
431
|
+
--sheet-active: color-mix(in srgb, var(--sheet-accent) 22%, white);
|
|
432
|
+
--sheet-match: color-mix(in srgb, var(--sheet-accent) 14%, white);
|
|
433
|
+
--sheet-current: color-mix(in srgb, var(--sheet-accent) 45%, white);
|
|
434
|
+
--sheet-ink: color-mix(in srgb, var(--sheet-accent) 55%, #1c1d1e);
|
|
435
|
+
--sheet-head: #f3f4f5;
|
|
436
|
+
--sheet-grid: #ebedef;
|
|
437
|
+
--sheet-rule: #d9dcdf;
|
|
438
|
+
position: relative;
|
|
439
|
+
display: flex;
|
|
440
|
+
flex-direction: column;
|
|
441
|
+
height: clamp(420px, calc(100vh - 220px), 860px);
|
|
442
|
+
border: 1px solid #dcdfe2;
|
|
443
|
+
border-radius: 8px;
|
|
444
|
+
background: #fff;
|
|
445
|
+
overflow: hidden;
|
|
446
|
+
font-size: 13px;
|
|
447
|
+
line-height: 1.5;
|
|
448
|
+
overflow-wrap: normal;
|
|
449
|
+
}
|
|
450
|
+
.sheet-viewer.is-full {
|
|
451
|
+
position: fixed;
|
|
452
|
+
inset: 0;
|
|
453
|
+
z-index: 100;
|
|
454
|
+
height: 100vh;
|
|
455
|
+
border-radius: 0;
|
|
456
|
+
border: 0;
|
|
457
|
+
}
|
|
458
|
+
.sheet-viewer.is-resizing {
|
|
459
|
+
cursor: col-resize;
|
|
460
|
+
user-select: none;
|
|
461
|
+
}
|
|
462
|
+
.sheet-toolbar {
|
|
463
|
+
display: flex;
|
|
464
|
+
flex-wrap: wrap;
|
|
465
|
+
align-items: center;
|
|
466
|
+
gap: 8px;
|
|
467
|
+
padding: 8px 10px;
|
|
468
|
+
border-bottom: 1px solid #e6e8ea;
|
|
469
|
+
background: #fafbfb;
|
|
470
|
+
}
|
|
471
|
+
.sheet-full-button {
|
|
472
|
+
display: inline-flex;
|
|
473
|
+
align-items: center;
|
|
474
|
+
justify-content: center;
|
|
475
|
+
flex: 0 0 32px;
|
|
476
|
+
width: 32px;
|
|
477
|
+
height: 32px;
|
|
478
|
+
padding: 0;
|
|
479
|
+
border: 0;
|
|
480
|
+
background: transparent;
|
|
481
|
+
color: #555;
|
|
482
|
+
cursor: pointer;
|
|
483
|
+
}
|
|
484
|
+
.sheet-full-button svg {
|
|
485
|
+
width: 18px;
|
|
486
|
+
height: 18px;
|
|
487
|
+
}
|
|
488
|
+
.sheet-find {
|
|
489
|
+
display: flex;
|
|
490
|
+
align-items: center;
|
|
491
|
+
gap: 8px;
|
|
492
|
+
flex: 0 1 260px;
|
|
493
|
+
min-width: 180px;
|
|
494
|
+
height: 32px;
|
|
495
|
+
padding: 0 10px;
|
|
496
|
+
border: 1px solid #dee1e4;
|
|
497
|
+
border-radius: 6px;
|
|
498
|
+
background: #fff;
|
|
499
|
+
}
|
|
500
|
+
.sheet-find:focus-within {
|
|
501
|
+
border-color: var(--accent-border, #76caff);
|
|
502
|
+
}
|
|
503
|
+
.sheet-find-icon {
|
|
504
|
+
width: 11px;
|
|
505
|
+
height: 11px;
|
|
506
|
+
flex-shrink: 0;
|
|
507
|
+
border: 1.5px solid #999;
|
|
508
|
+
border-radius: 50%;
|
|
509
|
+
}
|
|
510
|
+
.sheet-find input {
|
|
511
|
+
flex: 1;
|
|
512
|
+
min-width: 0;
|
|
513
|
+
padding: 0;
|
|
514
|
+
border: 0;
|
|
515
|
+
border-radius: 0;
|
|
516
|
+
outline: 0;
|
|
517
|
+
background: transparent;
|
|
518
|
+
font-size: 13px;
|
|
519
|
+
}
|
|
520
|
+
.sheet-find-count {
|
|
521
|
+
font-size: 12px;
|
|
522
|
+
color: #888;
|
|
523
|
+
white-space: nowrap;
|
|
524
|
+
}
|
|
525
|
+
.sheet-spacer {
|
|
526
|
+
flex: 1;
|
|
527
|
+
}
|
|
528
|
+
.sheet-button,
|
|
529
|
+
.sheet-download {
|
|
530
|
+
display: inline-flex;
|
|
531
|
+
align-items: center;
|
|
532
|
+
height: 32px;
|
|
533
|
+
padding: 0 12px;
|
|
534
|
+
border: 1px solid #dee1e4;
|
|
535
|
+
border-radius: 6px;
|
|
536
|
+
background: #fff;
|
|
537
|
+
color: #1f2124;
|
|
538
|
+
font-size: 13px;
|
|
539
|
+
white-space: nowrap;
|
|
540
|
+
}
|
|
541
|
+
.sheet-button[aria-pressed="true"] {
|
|
542
|
+
background: var(--sheet-soft);
|
|
543
|
+
border-color: var(--sheet-accent);
|
|
544
|
+
color: var(--sheet-ink);
|
|
545
|
+
}
|
|
546
|
+
.sheet-download {
|
|
547
|
+
padding: 0 14px;
|
|
548
|
+
border-color: var(--sheet-accent);
|
|
549
|
+
background: var(--sheet-accent);
|
|
550
|
+
color: #fff;
|
|
551
|
+
font-weight: 500;
|
|
552
|
+
}
|
|
553
|
+
.sheet-download,
|
|
554
|
+
.sheet-download:hover {
|
|
555
|
+
text-decoration: none;
|
|
556
|
+
}
|
|
557
|
+
.sheet-download:hover {
|
|
558
|
+
filter: brightness(0.94);
|
|
559
|
+
}
|
|
560
|
+
.sheet-formula {
|
|
561
|
+
display: flex;
|
|
562
|
+
align-items: stretch;
|
|
563
|
+
min-height: 34px;
|
|
564
|
+
border-bottom: 1px solid #e6e8ea;
|
|
565
|
+
}
|
|
566
|
+
.sheet-name-box,
|
|
567
|
+
.sheet-fx {
|
|
568
|
+
display: flex;
|
|
569
|
+
align-items: center;
|
|
570
|
+
justify-content: center;
|
|
571
|
+
flex-shrink: 0;
|
|
572
|
+
border-right: 1px solid #e6e8ea;
|
|
573
|
+
}
|
|
574
|
+
.sheet-name-box {
|
|
575
|
+
width: 72px;
|
|
576
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
577
|
+
font-size: 12px;
|
|
578
|
+
color: #333;
|
|
579
|
+
}
|
|
580
|
+
.sheet-fx {
|
|
581
|
+
width: 36px;
|
|
582
|
+
color: #aaa;
|
|
583
|
+
font-family: Georgia, serif;
|
|
584
|
+
font-style: italic;
|
|
585
|
+
}
|
|
586
|
+
.sheet-formula-value {
|
|
587
|
+
flex: 1;
|
|
588
|
+
min-width: 0;
|
|
589
|
+
max-height: 110px;
|
|
590
|
+
padding: 8px 12px;
|
|
591
|
+
overflow: auto;
|
|
592
|
+
white-space: pre-wrap;
|
|
593
|
+
overflow-wrap: anywhere;
|
|
594
|
+
line-height: 1.55;
|
|
595
|
+
color: #222;
|
|
596
|
+
}
|
|
597
|
+
.sheet-grid {
|
|
598
|
+
position: relative;
|
|
599
|
+
flex: 1;
|
|
600
|
+
min-height: 0;
|
|
601
|
+
overflow: auto;
|
|
602
|
+
outline: none;
|
|
603
|
+
background: #fff;
|
|
604
|
+
}
|
|
605
|
+
.sheet-grid:focus-visible {
|
|
606
|
+
box-shadow: inset 0 0 0 2px var(--accent-border, #76caff);
|
|
607
|
+
}
|
|
608
|
+
article .sheet-grid table {
|
|
609
|
+
width: auto;
|
|
610
|
+
margin: 0;
|
|
611
|
+
border-collapse: separate;
|
|
612
|
+
border-spacing: 0;
|
|
613
|
+
table-layout: fixed;
|
|
614
|
+
font-size: 13.5px;
|
|
615
|
+
line-height: 1.5;
|
|
616
|
+
}
|
|
617
|
+
article .sheet-grid :is(th, td) {
|
|
618
|
+
border: 0;
|
|
619
|
+
border-radius: 0;
|
|
620
|
+
overflow-wrap: normal;
|
|
621
|
+
}
|
|
622
|
+
article .sheet-grid th:first-child,
|
|
623
|
+
article .sheet-grid th:last-child {
|
|
624
|
+
border-radius: 0;
|
|
625
|
+
}
|
|
626
|
+
article .sheet-grid thead th {
|
|
627
|
+
position: sticky;
|
|
628
|
+
top: 0;
|
|
629
|
+
z-index: 3;
|
|
630
|
+
height: 26px;
|
|
631
|
+
padding: 0;
|
|
632
|
+
background: var(--sheet-head);
|
|
633
|
+
color: #666;
|
|
634
|
+
font-size: 12px;
|
|
635
|
+
font-weight: 500;
|
|
636
|
+
text-align: center;
|
|
637
|
+
border-right: 1px solid var(--sheet-rule);
|
|
638
|
+
border-bottom: 1px solid var(--sheet-rule);
|
|
639
|
+
user-select: none;
|
|
640
|
+
}
|
|
641
|
+
article .sheet-grid thead .sheet-corner {
|
|
642
|
+
left: 0;
|
|
643
|
+
z-index: 5;
|
|
644
|
+
}
|
|
645
|
+
article .sheet-grid .sheet-row-head {
|
|
646
|
+
position: sticky;
|
|
647
|
+
left: 0;
|
|
648
|
+
z-index: 2;
|
|
649
|
+
padding: 8px 0 0;
|
|
650
|
+
background: var(--sheet-head);
|
|
651
|
+
color: #777;
|
|
652
|
+
font-size: 12px;
|
|
653
|
+
font-weight: 400;
|
|
654
|
+
text-align: center;
|
|
655
|
+
vertical-align: top;
|
|
656
|
+
border-right: 1px solid var(--sheet-rule);
|
|
657
|
+
border-bottom: 1px solid #e4e6e8;
|
|
658
|
+
user-select: none;
|
|
659
|
+
}
|
|
660
|
+
article .sheet-grid :is(.sheet-col-head, .sheet-row-head).is-active {
|
|
661
|
+
background: var(--sheet-active);
|
|
662
|
+
color: var(--sheet-ink);
|
|
663
|
+
font-weight: 700;
|
|
664
|
+
}
|
|
665
|
+
.sheet-resize {
|
|
666
|
+
position: absolute;
|
|
667
|
+
top: 0;
|
|
668
|
+
right: -4px;
|
|
669
|
+
bottom: 0;
|
|
670
|
+
z-index: 2;
|
|
671
|
+
width: 8px;
|
|
672
|
+
cursor: col-resize;
|
|
673
|
+
touch-action: none;
|
|
674
|
+
}
|
|
675
|
+
.sheet-resize:hover {
|
|
676
|
+
background: color-mix(in srgb, var(--sheet-accent) 35%, transparent);
|
|
677
|
+
}
|
|
678
|
+
article .sheet-grid td {
|
|
679
|
+
padding: 8px 10px;
|
|
680
|
+
vertical-align: top;
|
|
681
|
+
text-align: left;
|
|
682
|
+
background: #fff;
|
|
683
|
+
border-right: 1px solid var(--sheet-grid);
|
|
684
|
+
border-bottom: 1px solid var(--sheet-grid);
|
|
685
|
+
cursor: cell;
|
|
686
|
+
}
|
|
687
|
+
article .sheet-grid td > div {
|
|
688
|
+
overflow: hidden;
|
|
689
|
+
text-overflow: ellipsis;
|
|
690
|
+
white-space: nowrap;
|
|
691
|
+
word-break: keep-all;
|
|
692
|
+
overflow-wrap: anywhere;
|
|
693
|
+
}
|
|
694
|
+
.sheet-viewer.is-wrapped .sheet-grid td > div,
|
|
695
|
+
article .sheet-grid td.is-expanded > div {
|
|
696
|
+
white-space: pre-wrap;
|
|
697
|
+
}
|
|
698
|
+
article .sheet-grid td.is-number {
|
|
699
|
+
text-align: right;
|
|
700
|
+
font-variant-numeric: tabular-nums;
|
|
701
|
+
}
|
|
702
|
+
article .sheet-grid .sheet-header-row > * {
|
|
703
|
+
position: sticky;
|
|
704
|
+
top: 26px;
|
|
705
|
+
z-index: 1;
|
|
706
|
+
font-weight: 700;
|
|
707
|
+
background: #fafbfb;
|
|
708
|
+
border-bottom: 2px solid #d0d4d8;
|
|
709
|
+
}
|
|
710
|
+
article .sheet-grid .sheet-header-row > .sheet-row-head {
|
|
711
|
+
z-index: 4;
|
|
712
|
+
font-weight: 400;
|
|
713
|
+
background: var(--sheet-head);
|
|
714
|
+
}
|
|
715
|
+
article .sheet-grid .sheet-header-row > .sheet-row-head.is-active {
|
|
716
|
+
font-weight: 700;
|
|
717
|
+
background: var(--sheet-active);
|
|
718
|
+
}
|
|
719
|
+
article .sheet-grid td.is-selected {
|
|
720
|
+
position: relative;
|
|
721
|
+
z-index: 1;
|
|
722
|
+
background: var(--sheet-soft);
|
|
723
|
+
box-shadow: inset 0 0 0 2px var(--sheet-accent);
|
|
724
|
+
}
|
|
725
|
+
article .sheet-grid .sheet-header-row > td.is-selected {
|
|
726
|
+
position: sticky;
|
|
727
|
+
z-index: 2;
|
|
728
|
+
}
|
|
729
|
+
article .sheet-grid td.is-match {
|
|
730
|
+
background: var(--sheet-match);
|
|
731
|
+
}
|
|
732
|
+
article .sheet-grid td.is-current-match {
|
|
733
|
+
background: var(--sheet-current);
|
|
734
|
+
}
|
|
735
|
+
.sheet-footer {
|
|
736
|
+
display: flex;
|
|
737
|
+
align-items: stretch;
|
|
738
|
+
height: 36px;
|
|
739
|
+
flex-shrink: 0;
|
|
740
|
+
border-top: 1px solid #dcdfe2;
|
|
741
|
+
background: var(--sheet-head);
|
|
742
|
+
}
|
|
743
|
+
.sheet-arrows {
|
|
744
|
+
display: flex;
|
|
745
|
+
align-items: center;
|
|
746
|
+
gap: 2px;
|
|
747
|
+
padding: 0 6px;
|
|
748
|
+
border-right: 1px solid #dcdfe2;
|
|
749
|
+
}
|
|
750
|
+
.sheet-arrow {
|
|
751
|
+
width: 26px;
|
|
752
|
+
height: 26px;
|
|
753
|
+
padding: 0;
|
|
754
|
+
border: 0;
|
|
755
|
+
border-radius: 4px;
|
|
756
|
+
background: transparent;
|
|
757
|
+
color: #666;
|
|
758
|
+
font-size: 16px;
|
|
759
|
+
line-height: 1;
|
|
760
|
+
}
|
|
761
|
+
.sheet-arrow:hover {
|
|
762
|
+
background: #e6e8ea;
|
|
763
|
+
}
|
|
764
|
+
.sheet-tabs {
|
|
765
|
+
display: flex;
|
|
766
|
+
align-items: stretch;
|
|
767
|
+
flex: 1;
|
|
768
|
+
min-width: 0;
|
|
769
|
+
overflow-x: auto;
|
|
770
|
+
}
|
|
771
|
+
.sheet-tab {
|
|
772
|
+
display: flex;
|
|
773
|
+
align-items: center;
|
|
774
|
+
flex-shrink: 0;
|
|
775
|
+
gap: 8px;
|
|
776
|
+
margin-top: -1px;
|
|
777
|
+
padding: 0 18px;
|
|
778
|
+
border: 0;
|
|
779
|
+
border-right: 1px solid #dcdfe2;
|
|
780
|
+
border-radius: 0;
|
|
781
|
+
background: transparent;
|
|
782
|
+
color: #666;
|
|
783
|
+
font-size: 13px;
|
|
784
|
+
white-space: nowrap;
|
|
785
|
+
}
|
|
786
|
+
.sheet-tab:hover {
|
|
787
|
+
color: #1f2124;
|
|
788
|
+
}
|
|
789
|
+
.sheet-tab.is-active {
|
|
790
|
+
background: #fff;
|
|
791
|
+
color: var(--sheet-ink);
|
|
792
|
+
font-weight: 700;
|
|
793
|
+
box-shadow: inset 0 -2px 0 var(--sheet-accent);
|
|
794
|
+
}
|
|
795
|
+
.sheet-tab-count {
|
|
796
|
+
font-size: 11px;
|
|
797
|
+
font-weight: 400;
|
|
798
|
+
color: #9a9a9a;
|
|
799
|
+
}
|
|
800
|
+
.sheet-status {
|
|
801
|
+
display: flex;
|
|
802
|
+
align-items: center;
|
|
803
|
+
gap: 14px;
|
|
804
|
+
padding: 0 14px;
|
|
805
|
+
border-left: 1px solid #dcdfe2;
|
|
806
|
+
color: #777;
|
|
807
|
+
font-size: 12px;
|
|
808
|
+
white-space: nowrap;
|
|
809
|
+
}
|
|
810
|
+
.sheet-hint,
|
|
811
|
+
.sheet-message {
|
|
812
|
+
margin: 14px 0 0;
|
|
813
|
+
font-size: 12px;
|
|
814
|
+
color: #9a9a9a;
|
|
815
|
+
}
|
|
816
|
+
@media (max-width: 700px) {
|
|
817
|
+
.sheet-find {
|
|
818
|
+
flex: 1 1 180px;
|
|
819
|
+
}
|
|
820
|
+
.sheet-spacer,
|
|
821
|
+
.sheet-status span:first-child:empty {
|
|
822
|
+
display: none;
|
|
823
|
+
}
|
|
824
|
+
.sheet-status {
|
|
825
|
+
padding: 0 10px;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
377
828
|
article table {
|
|
378
829
|
width: 100%;
|
|
379
830
|
border-collapse: separate;
|
|
@@ -460,8 +911,8 @@ article img {
|
|
|
460
911
|
background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23727b85' stroke-width='1.3'%3E%3Ccircle cx='6.8' cy='6.8' r='5.2'/%3E%3Cpath d='m10.7 10.7 3.8 3.8'/%3E%3C/svg%3E") center / contain no-repeat;
|
|
461
912
|
}
|
|
462
913
|
.section-tools:focus-within {
|
|
463
|
-
border-color: #acd3f0;
|
|
464
|
-
box-shadow: 0 0 0 2px #acd3f0, 0 4px 10px #62b5ed24;
|
|
914
|
+
border-color: var(--accent-border, #acd3f0);
|
|
915
|
+
box-shadow: 0 0 0 2px var(--accent-border, #acd3f0), 0 4px 10px var(--accent-soft, #62b5ed24);
|
|
465
916
|
}
|
|
466
917
|
.section-tools input:focus-visible {
|
|
467
918
|
outline: none;
|
|
@@ -503,7 +954,7 @@ article img {
|
|
|
503
954
|
line-height: 1.8;
|
|
504
955
|
}
|
|
505
956
|
#toc a:hover {
|
|
506
|
-
color: var(--
|
|
957
|
+
color: var(--accent, #009dff);
|
|
507
958
|
}
|
|
508
959
|
#pagination {
|
|
509
960
|
display: flex;
|
|
@@ -535,7 +986,7 @@ article img {
|
|
|
535
986
|
font-weight: 500;
|
|
536
987
|
}
|
|
537
988
|
mark {
|
|
538
|
-
background: #fff1ad;
|
|
989
|
+
background: var(--accent-highlight, #fff1ad);
|
|
539
990
|
color: inherit;
|
|
540
991
|
border-radius: 2px;
|
|
541
992
|
}
|
|
@@ -588,7 +1039,7 @@ dialog::backdrop {
|
|
|
588
1039
|
border-top: 1px solid var(--line);
|
|
589
1040
|
}
|
|
590
1041
|
.result:hover {
|
|
591
|
-
background: #f5f9fc;
|
|
1042
|
+
background: var(--accent-soft, #f5f9fc);
|
|
592
1043
|
text-decoration: none;
|
|
593
1044
|
}
|
|
594
1045
|
.result small {
|
|
@@ -605,7 +1056,7 @@ dialog::backdrop {
|
|
|
605
1056
|
margin: 4px 0;
|
|
606
1057
|
}
|
|
607
1058
|
.result mark {
|
|
608
|
-
background: #dcf0ff;
|
|
1059
|
+
background: var(--accent-highlight, #dcf0ff);
|
|
609
1060
|
}
|
|
610
1061
|
@media (max-width: 1200px) {
|
|
611
1062
|
header,
|
|
@@ -659,13 +1110,21 @@ dialog::backdrop {
|
|
|
659
1110
|
padding-top: 25px;
|
|
660
1111
|
}
|
|
661
1112
|
article h1 {
|
|
662
|
-
font-size:
|
|
1113
|
+
font-size: 30px;
|
|
663
1114
|
}
|
|
664
1115
|
.folder-cards {
|
|
665
1116
|
grid-template-columns: minmax(0, 1fr);
|
|
666
1117
|
}
|
|
667
1118
|
article h2 {
|
|
668
|
-
font-size:
|
|
1119
|
+
font-size: 24px;
|
|
1120
|
+
}
|
|
1121
|
+
article h3 {
|
|
1122
|
+
font-size: 20px;
|
|
1123
|
+
line-height: 1.4;
|
|
1124
|
+
}
|
|
1125
|
+
article h4 {
|
|
1126
|
+
font-size: 18px;
|
|
1127
|
+
line-height: 1.5;
|
|
669
1128
|
}
|
|
670
1129
|
article table {
|
|
671
1130
|
font-size: 12px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unana_dev/doxen",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Config-first Markdown documentation sites with Korean and section search",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"markdown-it": "^14.1.0",
|
|
43
43
|
"markdown-it-container": "^4.0.0",
|
|
44
44
|
"mermaid": "^12.1.0",
|
|
45
|
+
"read-excel-file": "^9.3.14",
|
|
45
46
|
"sanitize-html": "^2.17.0",
|
|
46
47
|
"wrangler": "4.149.0"
|
|
47
48
|
},
|
package/src/build.js
CHANGED
|
@@ -46,7 +46,7 @@ export async function siteFiles(config, dev = false) {
|
|
|
46
46
|
const files = new Map();
|
|
47
47
|
const initial = new Intl.Segmenter("ko", { granularity: "grapheme" })
|
|
48
48
|
.segment(config.title.trim().normalize("NFC"))[Symbol.iterator]()
|
|
49
|
-
.next().value.segment;
|
|
49
|
+
.next().value.segment.replace(/[a-z]/g, (c) => c.toUpperCase());
|
|
50
50
|
files.set(
|
|
51
51
|
"/favicon.svg",
|
|
52
52
|
Buffer.from(
|
|
@@ -64,9 +64,12 @@ export async function siteFiles(config, dev = false) {
|
|
|
64
64
|
'<span class="brand-icon">D</span',
|
|
65
65
|
`<span class="brand-icon">${initial.replace(/[&<>"']/g, (c) => `&#${c.charCodeAt(0)};`)}</span`,
|
|
66
66
|
);
|
|
67
|
+
const theme = config.color
|
|
68
|
+
? `;--accent:${config.color};--accent-soft:color-mix(in srgb, ${config.color} 8%, white);--accent-border:color-mix(in srgb, ${config.color} 40%, white);--accent-highlight:color-mix(in srgb, ${config.color} 25%, white)`
|
|
69
|
+
: "";
|
|
67
70
|
html = html.replace(
|
|
68
71
|
"</head>",
|
|
69
|
-
`<style>:root{--icon-background:${config.icon.background};--icon-color:${config.icon.color};--icon-border:${config.icon.border}}</style></head>`,
|
|
72
|
+
`<style>:root{--icon-background:${config.icon.background};--icon-color:${config.icon.color};--icon-border:${config.icon.border}${theme}}</style></head>`,
|
|
70
73
|
);
|
|
71
74
|
html = html.replace(
|
|
72
75
|
"<title>Doxen</title>",
|
package/src/config.js
CHANGED
|
@@ -48,10 +48,14 @@ export async function loadConfig(cwd, configPath) {
|
|
|
48
48
|
throw new Error("icon은 HEX 색상 또는 background, color, border를 설정하는 객체여야 합니다.");
|
|
49
49
|
const icon = { background: "#edf8ff", color: "#467792", border: "#bcdff8" };
|
|
50
50
|
const hexColor = /^#(?:[\da-f]{3}|[\da-f]{6})$/i;
|
|
51
|
-
if (typeof config.
|
|
52
|
-
|
|
51
|
+
if (config.color !== undefined && (typeof config.color !== "string" || !hexColor.test(config.color)))
|
|
52
|
+
throw new Error("color는 #fff 또는 #ffffff 형식의 HEX 색상이어야 합니다.");
|
|
53
|
+
const color = config.color ?? (typeof config.icon === "string" ? config.icon : undefined);
|
|
54
|
+
const iconColor = config.icon ?? config.color;
|
|
55
|
+
if (typeof iconColor === "string") {
|
|
56
|
+
if (!hexColor.test(iconColor))
|
|
53
57
|
throw new Error("icon은 #fff 또는 #ffffff 형식의 HEX 색상이어야 합니다.");
|
|
54
|
-
const hex =
|
|
58
|
+
const hex = iconColor.slice(1);
|
|
55
59
|
const fullHex = hex.length === 3 ? [...hex].map((c) => c + c).join("") : hex;
|
|
56
60
|
const channels = fullHex.match(/../g).map((c) => parseInt(c, 16));
|
|
57
61
|
const mix = (target, amount) =>
|
|
@@ -107,6 +111,7 @@ export async function loadConfig(cwd, configPath) {
|
|
|
107
111
|
title: config.title,
|
|
108
112
|
description: config.description || "",
|
|
109
113
|
icon,
|
|
114
|
+
color,
|
|
110
115
|
tabs,
|
|
111
116
|
root,
|
|
112
117
|
file,
|
package/src/content.js
CHANGED
|
@@ -5,6 +5,7 @@ import MarkdownIt from "markdown-it";
|
|
|
5
5
|
import container from "markdown-it-container";
|
|
6
6
|
import GithubSlugger from "github-slugger";
|
|
7
7
|
import sanitizeHtml from "sanitize-html";
|
|
8
|
+
import readXlsxFile from "read-excel-file/node";
|
|
8
9
|
import { inside } from "./config.js";
|
|
9
10
|
|
|
10
11
|
const assetExtensions = new Set([
|
|
@@ -16,6 +17,7 @@ const assetExtensions = new Set([
|
|
|
16
17
|
".avif",
|
|
17
18
|
".ico",
|
|
18
19
|
".pdf",
|
|
20
|
+
".xlsx",
|
|
19
21
|
]);
|
|
20
22
|
const escape = (text) =>
|
|
21
23
|
text.replace(
|
|
@@ -47,7 +49,7 @@ async function walk(dir) {
|
|
|
47
49
|
continue;
|
|
48
50
|
const file = path.join(dir, entry.name);
|
|
49
51
|
if (entry.isDirectory()) files.push(...(await walk(file)));
|
|
50
|
-
else if (/\.md$/i.test(entry.name)) files.push(file);
|
|
52
|
+
else if (/\.(?:md|xlsx)$/i.test(entry.name)) files.push(file);
|
|
51
53
|
}
|
|
52
54
|
return files.sort((a, b) => a.localeCompare(b, "ko", { numeric: true }));
|
|
53
55
|
}
|
|
@@ -62,13 +64,26 @@ export async function collectSite(config) {
|
|
|
62
64
|
tab: tab.slug,
|
|
63
65
|
path: relative,
|
|
64
66
|
file,
|
|
65
|
-
source: await readFile(file, "utf8"),
|
|
67
|
+
source: await readFile(file, /\.xlsx$/i.test(file) ? undefined : "utf8"),
|
|
66
68
|
});
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
const byFile = new Map(documents.map((doc) => [doc.file, doc]));
|
|
70
72
|
const assets = new Map();
|
|
71
73
|
for (const doc of documents) {
|
|
74
|
+
if (/\.xlsx$/i.test(doc.path)) {
|
|
75
|
+
const hash = createHash("sha256").update(doc.source).digest("hex").slice(0, 20);
|
|
76
|
+
const sheets = await readXlsxFile(doc.source, { trim: false });
|
|
77
|
+
assets.set(`${hash}.xlsx`, doc.source);
|
|
78
|
+
assets.set(`${hash}.json`, Buffer.from(JSON.stringify(sheets)));
|
|
79
|
+
doc.title = path.basename(doc.path);
|
|
80
|
+
doc.spreadsheet = { data: `./assets/${hash}.json`, file: `./assets/${hash}.xlsx` };
|
|
81
|
+
doc.toc = [];
|
|
82
|
+
doc.sections = [];
|
|
83
|
+
delete doc.source;
|
|
84
|
+
delete doc.file;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
72
87
|
const slugger = new GithubSlugger();
|
|
73
88
|
const md = new MarkdownIt({
|
|
74
89
|
html: false,
|
package/src/dev.js
CHANGED