markdown-to-epub-converter

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Markdown to EPUB Converter Skill

Markdown转EPUB转换器Skill

This skill transforms markdown documents into professional EPUB ebook files. Perfect for converting research documents, blog posts, articles, or chat conversation summaries into portable, device-agnostic ebook formats.
本Skill可将Markdown文档转换为专业的EPUB电子书文件。非常适合将研究文档、博客文章、文章或聊天对话摘要转换为可移植、与设备无关的电子书格式。

Overview

概述

The skill accepts markdown content in multiple formats and generates a properly formatted EPUB3 file that works across all major ebook readers including:
  • Apple Books
  • Amazon Kindle (via Kindle for Mac/Windows/iOS/Android)
  • Google Play Books
  • Kobo and other EPUB readers
  • Any standard EPUB reader
本Skill支持多种格式的Markdown内容输入,生成格式规范的EPUB3文件,可在所有主流电子书阅读器中使用,包括:
  • Apple Books
  • Amazon Kindle(通过Kindle for Mac/Windows/iOS/Android)
  • Google Play Books
  • Kobo及其他EPUB阅读器
  • 任何标准EPUB阅读器

Input Formats

输入格式

Option 1: Raw Markdown Text

选项1:原始Markdown文本

Provide markdown content directly in your message:
Convert this markdown to EPUB:
直接在消息中提供Markdown内容:
Convert this markdown to EPUB:

My Book Title

My Book Title

Chapter 1

Chapter 1

This is chapter one content...
undefined
This is chapter one content...
undefined

Option 2: File Path

选项2:文件路径

Provide a path to a markdown file to be converted.
提供Markdown文件的路径进行转换。

How It Works

工作原理

  1. Markdown Parsing: Analyzes your markdown and automatically:
    • Treats H1 headers (
      #
      ) as chapter boundaries
    • Treats H2 headers (
      ##
      ) as section headings within chapters
    • Preserves formatting (bold, italic, links, lists, code blocks)
  2. Structure Generation: Creates proper EPUB structure:
    • Automatic table of contents from chapters
    • Navigation document (EPUB3 standard)
    • Metadata (title, language, etc.)
  3. File Creation: Generates a valid EPUB3 file ready for download and use
  1. Markdown解析:分析你的Markdown内容,并自动:
    • 将H1标题(
      #
      )视为章节边界
    • 将H2标题(
      ##
      )视为章节内的小节标题
    • 保留格式(粗体、斜体、链接、列表、代码块)
  2. 结构生成:创建规范的EPUB结构:
    • 基于章节自动生成目录
    • 导航文档(符合EPUB3标准)
    • 元数据(标题、语言等)
  3. 文件创建:生成可直接下载使用的有效EPUB3文件

Usage Examples

使用示例

Example 1: Convert a Blog Post

示例1:转换博客文章

"Convert this markdown blog post to EPUB:
"将这篇Markdown博客文章转换为EPUB:

How to Build a Simple Web Server

如何搭建简单的Web服务器

Introduction

简介

...content..."
...内容..."

Example 2: Convert a Research Summary

示例2:转换研究摘要

"I have research notes in markdown format. Convert them to an EPUB ebook. The content is:
"我有一份Markdown格式的研究笔记。将它们转换为EPUB电子书。内容如下:

Research Project: Machine Learning Basics

研究项目:机器学习基础

Chapter 1: Fundamentals

第1章:基础知识

..."
..."

Example 3: Convert a Chat Summary

示例3:转换聊天摘要

"Summarize our conversation so far as markdown and convert it to an EPUB for reference"
"将我们到目前为止的对话整理为Markdown格式并转换为EPUB以便参考"

Output

输出结果

The skill generates a downloadable EPUB file that includes:
  • Professional formatting
  • Automatic table of contents
  • Proper chapter structure
  • Support for markdown formatting elements:
    • Headers (all levels)
    • Bold and italic text
    • Hyperlinks
    • Lists (ordered and unordered)
    • Code blocks and inline code
    • Blockquotes
    • Horizontal rules
本Skill生成可下载的EPUB文件,包含:
  • 专业格式
  • 自动生成的目录
  • 规范的章节结构
  • 支持Markdown格式化元素:
    • 各级标题
    • 粗体和斜体文本
    • 超链接
    • 列表(有序和无序列表)
    • 代码块和行内代码
    • 块引用
    • 水平线

Markdown Elements Supported

支持的Markdown元素

ElementMarkdownSupportNotes
Headers
# H1
through
###### H6
FullAuto TOC generation
Bold
**text**
or
__text__
Full
Italic
*text*
or
_text_
Full
Links
[text](url)
FullClickable in ebooks
Lists
- item
or
1. item
FullNested lists supported
Code blocks
```language
EnhancedSyntax highlighting ready, monospace fonts
Inline code
 
code
 
EnhancedStyled background, borders
TablesMarkdown tablesEnhancedStyled headers, alternating rows
Blockquotes
> quote
FullStyled with left border
Horizontal rule
---
or
***
Full
元素Markdown语法支持情况说明
标题
# H1
###### H6
完全支持自动生成目录
粗体
**text**
__text__
完全支持
斜体
*text*
_text_
完全支持
链接
[text](url)
完全支持在电子书中可点击
列表
- item
1. item
完全支持支持嵌套列表
代码块
```language
增强支持支持语法高亮,使用等宽字体
行内代码
 
code
 
增强支持带背景样式和边框
表格Markdown表格增强支持带样式化表头、交替行颜色
块引用
> quote
完全支持带左侧边框样式
水平线
---
***
完全支持

Advanced Features

高级功能

Enhanced Code Block Support

增强代码块支持

Code blocks are beautifully formatted with:
  • Premium monospace fonts: SF Mono, Monaco, Fira Code, Consolas, and more
  • Styled backgrounds: Subtle gray background with blue accent border
  • Language detection: Specify language after
    ```
    for future syntax highlighting
  • Proper escaping: HTML characters are safely escaped
  • Overflow handling: Horizontal scrolling for long lines
Example:
python
def fibonacci(n):
    if n <= 1:
        return n
    return fibonacci(n-1) + fibonacci(n-2)
代码块采用精美的格式设置:
  • 优质等宽字体:SF Mono、Monaco、Fira Code、Consolas等
  • 样式化背景:浅灰色背景搭配蓝色强调边框
  • 语言检测:在
    ```
    后指定语言,以便后续实现语法高亮
  • 正确转义:HTML字符被安全转义
  • 溢出处理:长行内容支持水平滚动
示例:
python
def fibonacci(n):
    if n <= 1:
        return n
    return fibonacci(n-1) + fibonacci(n-2)

Enhanced Table Support

增强表格支持

Tables are rendered with professional styling:
  • Styled headers: Blue background with white text
  • Alternating rows: Zebra striping for readability
  • Cell padding: Comfortable spacing for easy reading
  • Inline formatting: Code, bold, italic, and links work in cells
  • Responsive: Tables adapt to different screen sizes
Example:
FeatureStatusNotes
HeadersFull support
CodeEnhanced styling
TablesProfessional layout
表格采用专业样式渲染:
  • 样式化表头:蓝色背景搭配白色文字
  • 交替行颜色:斑马线样式提升可读性
  • 单元格内边距:舒适的间距便于阅读
  • 行内格式:单元格内支持代码、粗体、斜体和链接
  • 响应式设计:表格可适配不同屏幕尺寸
示例:
功能状态说明
标题完全支持
代码增强样式
表格专业布局

Custom Title and Metadata

自定义标题和元数据

You can specify EPUB metadata:
  • Book title (defaults to first H1 header)
  • Author name
  • Language
  • Publication date
你可以指定EPUB元数据:
  • 书籍标题(默认使用第一个H1标题)
  • 作者姓名
  • 语言
  • 出版日期

Chapter Organization

章节组织

Chapters are automatically detected from:
  • H1 headers (
    #
    ) as primary chapter breaks
  • Logical content sections between H1s
  • Automatic page breaks between chapters
章节自动从以下内容中识别:
  • H1标题(
    #
    )作为主要章节分隔符
  • H1之间的逻辑内容小节
  • 章节之间自动分页

Styling

样式设置

The generated EPUB uses clean, readable default styling that:
  • Respects the reader's font preferences
  • Works on all screen sizes
  • Maintains proper spacing and hierarchy
  • Includes appropriate margins and padding
生成的EPUB采用简洁易读的默认样式:
  • 尊重阅读器的字体偏好
  • 适配所有屏幕尺寸
  • 保持适当的间距和层级结构
  • 包含合适的边距和内边距

Technical Details

技术细节

  • Format: EPUB3 (compatible with all modern readers)
  • Encoding: UTF-8
  • HTML Version: XHTML 1.1
  • CSS Support: Responsive styling
  • 格式:EPUB3(兼容所有现代阅读器)
  • 编码:UTF-8
  • HTML版本:XHTML 1.1
  • CSS支持:响应式样式

Downloading Your EPUB

下载你的EPUB文件

After generation, the file will be available for download. You can then:
  1. Download the EPUB to your computer
  2. Open it with your preferred ebook reader
  3. Transfer to your Kindle, iPad, or other device
  4. Upload directly to Kindle via email or cloud
生成完成后,文件将可供下载。你可以:
  1. 将EPUB下载到电脑
  2. 使用你偏好的电子书阅读器打开
  3. 传输到Kindle、iPad或其他设备
  4. 通过电子邮件或云端直接上传至Kindle

Tips for Best Results

最佳实践建议

  1. Use Proper Markdown Structure: The skill works best when markdown follows standard conventions (H1 for titles, H2 for sections)
  2. Clear Chapter Breaks: Use H1 headers to clearly mark chapter divisions
  3. Descriptive Headers: Headers become the table of contents, so make them clear and descriptive
  4. Content Organization: Place content logically between headers
  5. Supported Formatting: Stick to basic markdown formatting for best compatibility across all readers
  1. 使用标准Markdown结构:当Markdown遵循标准规范(H1作为标题,H2作为小节)时,本Skill的效果最佳
  2. 清晰的章节分隔:使用H1标题明确标记章节划分
  3. 描述性标题:标题会成为目录内容,因此请确保标题清晰且具有描述性
  4. 内容合理组织:在标题之间逻辑化地安排内容
  5. 使用支持的格式:为确保在所有阅读器中都有最佳兼容性,请使用基础Markdown格式

Troubleshooting

故障排除

EPUB doesn't open: Ensure your markdown is properly formatted. Check for matching brackets in links and proper syntax.
Table of contents is empty: Make sure your markdown includes H1 headers to define chapters.
Formatting looks different: EPUB readers apply their own fonts and styling. This is normal and expected behavior.
EPUB无法打开:确保你的Markdown格式正确。检查链接中的括号是否匹配,语法是否规范。
目录为空:确保你的Markdown包含用于定义章节的H1标题。
格式显示不同:EPUB阅读器会应用自身的字体和样式。这是正常且预期的行为。

Scripts

脚本

  • epub_generator.py
    - Core EPUB file creation and formatting
  • markdown_processor.py
    - Markdown parsing and structure extraction
  • epub_generator.py
    - 核心EPUB文件创建和格式化脚本
  • markdown_processor.py
    - Markdown解析和结构提取脚本

Future Enhancements

未来增强功能

  • Auto-generated cover pages with custom images
  • Kindle-specific optimizations (.mobi format)
  • Custom CSS styling per user preferences
  • Multi-document merging
  • Image embedding and optimization
  • Advanced metadata support
  • 自动生成带自定义图片的封面
  • 针对Kindle的优化(.mobi格式)
  • 支持用户自定义CSS样式
  • 多文档合并
  • 图片嵌入与优化
  • 高级元数据支持