1 unstable release
Uses new Rust 2024
| new 0.1.0 | Feb 23, 2026 |
|---|
#25 in #publish
Used in typub-ui
14KB
223 lines
typub
English | 中文
typub is a Typst-first, multi-platform publishing tool.
Key Features
🎯 Typst-first with Markdown-compatibility
Write content in Typst (content.typ) or Markdown (content.md). Typst is the primary format with powerful typesetting capabilities, while Markdown provides a familiar alternative. Both formats can be published to any supported platform.
🌐 Multiple-platform Compatibility
Publish to multiple platforms from a single content source:
- API-based: Dev.to, Ghost, HashNode, Confluence, Notion, WordPress
- Copy-paste (HTML): WeChat, Zhihu, Toutiao, Bilibili, Weibo, Baijiahao, Wangyihao, Sohu, Sspai, OSChina
- Copy-paste (Markdown): CSDN, Juejin, SegmentFault, Cnblogs, Medium, Jianshu, InfoQ, 51CTO, TencentCloud, Aliyun, HuaweiCloud, Elecfans, ModelScope, Volcengine
- Local output: Astro, Static, Xiaohongshu
👀 Dev Preview
Preview your content locally before publishing:
- Live reload: Auto-refresh on save with built-in dev server (
typub dev) - Platform-specific preview: See exactly how content renders on each platform
- Theme support: Choose from built-in themes (github, notion, minimal, tech, etc.) or create custom ones
- Math rendering: MathJax-powered LaTeX rendering
# Preview with auto-reload
typub dev posts/my-post -p ghost
# Preview for different platforms
typub dev posts/my-post -p confluence
Themes are configured in meta.toml or typub.toml, not via command-line arguments.
🖥️ Terminal User Interface (TUI)
Interactive terminal dashboard for content management:
- Post management: Browse, sort, and manage all your posts
- Platform overview: See publishing status across all platforms at a glance
- Preview content: Preview posts in terminal or browser for selected platform
- Publish control: Selectively publish to individual platforms or all at once
- Real-time progress: Track publishing progress and results
# Launch interactive TUI dashboard
typub tui
📦 4 Asset Strategies
Choose how images and other assets are handled:
- embed: Base64 encode inline — small images, no upload dependency
- upload: Upload to platform storage — platforms with native media APIs
- copy: Copy to local output — local/static outputs
- external: Upload to S3-compatible host — CDN, large assets, cross-platform URLs
📐 3 Math Rendering Strategies
Render mathematical expressions based on platform capabilities:
- SVG: Platform supports inline SVG — use Typst's native SVG rendering (default)
- LaTeX: Platform requires LaTeX math macros — preserve original LaTeX source
- PNG: Platform supports base64 images but not SVG — rasterize to PNG via resvg
⚙️ Layered Config System
Manage configuration with 5-level resolution priority (highest to lowest):
- Post-platform: Per-content platform-specific (
meta.toml→[platforms.<id>]) - Post: Per-content default (
meta.toml→ top level) - Global-platform: Global platform-specific (
typub.toml→[platforms.<id>]) - Global: Global default (
typub.toml→ top level) - Adapter default (fallback)
Showcases
Preview Examples



Documentation Map
For users (publishing content)
- Basic path:
docs/guide/getting-started.md - Platform setup:
docs/guide/adapters.md - Assets:
docs/guide/assets.md - Copy-paste profiles:
docs/guide/profiles.md - Advanced customization:
docs/guide/advanced-customization.md
For developers (contributing to typub)
- Development workflow:
DEVELOPING_GUIDE.md - Agent/contributor guardrails:
CLAUDE.md - Specifications and architecture:
docs/rfc/anddocs/adr/
User Basics
Install
cargo install typub
Minimal flow
typub init
typub new "My Post"
typub dev posts/my-post -p ghost
typub publish posts/my-post -p ghost
User Advanced Features
- Per-platform asset strategy (
embed/upload/copy/external) - External storage integration for cross-platform asset URLs
- Copy-paste profile selection and customization
- Node policy override (
raw/unknown) via platform config
See docs/guide/advanced-customization.md for a platform-agnostic overview.
License
MIT
lib.rs:
Logging foundation for typub based on tracing.
This crate provides:
- Re-exported
tracingmacros (debug!,info!,warn!,error!) - A custom
CliLayerfor CLI-formatted output with icons and colors - The
ProgressReportertrait for decoupling progress reporting from UI
Per [[ADR-0004]], this crate is Layer 0 (no internal typub dependencies).
Usage
use typub_log::{debug, info, warn, error};
// Structured logging with tracing
info!(file = %path.display(), "Processing file");
debug!(count = 42, "Items processed");
warn!(platform = "ghost", "Rate limit approaching");
error!(error = %e, "Upload failed");
Initialization
Call init() at CLI startup to install the CLI subscriber:
typub_log::init(verbose);
Dependencies
~8–12MB
~129K SLoC