Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/convert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ jobs:
- name: Install dependencies
run: pip install -r requirements.txt

- name: Install pandoc
run: sudo apt-get update && sudo apt-get install -y pandoc

- name: Process content
run: python scripts/process.py
env:
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

GitHub-hosted content shelf. Fork, upload, done.

> Fork this repo to get your own content platform on GitHub Pages. Upload PDFs or EPUBs (auto-converted to books), Markdown documents (rendered directly), or ZIP archives (deployed as static sites). Zero server cost.
> Fork this repo to get your own content platform on GitHub Pages. Upload PDFs or EPUBs (published as online books), Markdown documents (rendered directly), or ZIP archives (deployed as static sites). Zero server cost.

## Quick Start

Expand Down Expand Up @@ -41,7 +41,7 @@ Your site is now live at `https://<your-username>.github.io/gitshelf/`
([Create one here](https://github.com/settings/tokens/new?scopes=repo&description=GitShelf))
3. Upload a file:
- **`.pdf`** — Converted to a multi-chapter book via MinerU API
- **`.epub`** — Converted to a multi-chapter book via pandoc
- **`.epub`** — Stored as-is and read directly in the browser with TOC navigation
- **`.md`** — Rendered directly as a document
- **`.zip`** — Extracted as a static site (must contain `index.html`)
4. Wait for GitHub Actions to process (progress shown in Actions tab)
Expand All @@ -68,7 +68,7 @@ Your site is now live at `https://<your-username>.github.io/gitshelf/`
Upload content (browser → GitHub API → input/)
→ GitHub Actions runs scripts/process.py
→ .pdf: MinerU API → Markdown → Split chapters → docs/books/{id}/
→ .epub: pandoc → Markdown + media → Split chapters → docs/books/{id}/
→ .epub: Store original EPUB + extract TOC → docs/books/{id}/
→ .md: Copy to docs/articles/{id}/content.md
→ .zip: Extract to docs/sites/{id}/
→ Build manifest → GitHub Pages deploys
Expand All @@ -90,7 +90,7 @@ python -m unittest discover -s tests/scripts -v # Python pipeline tests

**What if MinerU stops being free?** Swap it by modifying `scripts/mineru_client.py`. Works with any PDF-to-Markdown tool.

**Can I edit converted chapters?** Yes. Edit `.md` files in `docs/books/<id>/chapters/` and commit.
**Can I edit converted chapters?** Yes for PDF-converted books. Edit `.md` files in `docs/books/<id>/chapters/` and commit. EPUB books are read from the original `book.epub`.

**Can I upload a static site?** Yes. Package it as a `.zip` with `index.html` at the root and upload through the admin panel.

Expand Down
8 changes: 4 additions & 4 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

基于 GitHub 的内容托管平台。Fork,上传,搞定。

> Fork 本仓库即可拥有自己的内容平台。上传 PDF 或 EPUB(自动转换为书籍)、Markdown 文档(直接渲染)、ZIP 压缩包(部署为静态站点),全部托管在 GitHub Pages 上。零服务器成本。
> Fork 本仓库即可拥有自己的内容平台。上传 PDF 或 EPUB(发布为在线书籍)、Markdown 文档(直接渲染)、ZIP 压缩包(部署为静态站点),全部托管在 GitHub Pages 上。零服务器成本。

## 快速开始

Expand Down Expand Up @@ -41,7 +41,7 @@
([点此创建](https://github.com/settings/tokens/new?scopes=repo&description=GitShelf))
3. 上传文件:
- **`.pdf`** — 通过 MinerU API 转换为多章节书籍
- **`.epub`** — 通过 pandoc 转换为多章节书籍
- **`.epub`** — 原样保存,并在浏览器中直接阅读,保留目录导航
- **`.md`** — 直接作为文档渲染展示
- **`.zip`** — 解压为静态站点(需包含 `index.html`)
4. 等待 GitHub Actions 处理完成
Expand All @@ -68,7 +68,7 @@
上传内容(浏览器 → GitHub API → input/)
→ GitHub Actions 运行 scripts/process.py
→ .pdf: MinerU API → Markdown → 拆分章节 → docs/books/{id}/
→ .epub: pandoc → Markdown + 媒体资源 → 拆分章节 → docs/books/{id}/
→ .epub: 保存原始 EPUB + 提取目录 → docs/books/{id}/
→ .md: 复制到 docs/articles/{id}/content.md
→ .zip: 解压到 docs/sites/{id}/
→ 构建 manifest → GitHub Pages 部署
Expand All @@ -90,7 +90,7 @@ python -m unittest discover -s tests/scripts -v # Python 流水线测试

**MinerU 收费了怎么办?** 修改 `scripts/mineru_client.py` 即可替换,兼容任何 PDF 转 Markdown 工具。

**可以手动编辑转换后的章节吗?** 可以。编辑 `docs/books/<id>/chapters/` 下的 `.md` 文件并提交即可。
**可以手动编辑转换后的章节吗?** PDF 转换得到的书籍可以。编辑 `docs/books/<id>/chapters/` 下的 `.md` 文件并提交即可。EPUB 书籍则直接读取原始 `book.epub`。

**可以上传静态站点吗?** 可以。将站点打包为 `.zip`(根目录需包含 `index.html`),通过管理面板上传即可。

Expand Down
6 changes: 4 additions & 2 deletions cli/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ function normalizeItem(raw) {
visibility: normalizeVisibility(m.visibility),
chapters_count: nullNum(m.chapters_count),
word_count: nullNum(m.word_count),
source_format: String(m.source_format || '').trim() || null,
created_at: String(m.created_at || '').trim() || null,
updated_at: String(m.updated_at || m.created_at || '').trim() || null,
source: String(m.source || '').trim() || null,
Expand Down Expand Up @@ -241,7 +242,7 @@ function buildPublicManifest(items) {
return {
items: pub.map((b) => {
const r = { id: b.id, type: b.type, title: getDisplayTitle(b), author: b.author || undefined, summary: b.summary || undefined, tags: b.tags, featured: b.featured, source: b.source, created_at: b.created_at, updated_at: b.updated_at };
if (b.type === 'book') { r.chapters_count = b.chapters_count; r.word_count = b.word_count; }
if (b.type === 'book') { r.chapters_count = b.chapters_count; r.word_count = b.word_count; r.source_format = b.source_format || undefined; }
else if (b.type === 'doc') { r.word_count = b.word_count; }
else if (b.type === 'site') { r.entry = b.entry; }
return r;
Expand All @@ -258,7 +259,8 @@ function serializeCatalog(items) {
author: b.author || '', summary: b.summary || '', tags: b.tags || [],
featured: b.featured, manual_order: b.manual_order,
visibility: normalizeVisibility(b.visibility), source: b.source || '',
entry: b.entry || undefined, chapters_count: b.chapters_count, word_count: b.word_count,
entry: b.entry || undefined, source_format: b.source_format || undefined,
chapters_count: b.chapters_count, word_count: b.word_count,
created_at: b.created_at, updated_at: b.updated_at,
})),
};
Expand Down
Loading
Loading