Skip to content

copyboy/html2md

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

HTML2MD - Blog Article Converter

Stars Forks License Java Spring Boot

Convert blog articles from Chinese platforms (CSDN, CNBLOG, WeChat) to Markdown/HTML format

ไธญๆ–‡ | English | Live Demo


โœจ Features

  • โœ… Multiple Platform Support: CSDN, CNBLOG, WeChat Official Account
  • โœ… Dual Format Export: Markdown and HTML
  • โœ… Batch Download: Process multiple URLs at once (comma-separated)
  • โœ… CSDN Categories: Download entire category/column articles
  • โœ… Clean Output: Remove ads, comments, and unnecessary elements
  • โœ… Web UI: Simple browser interface
  • โœ… API Mode: RESTful API for integration

๐Ÿš€ Quick Start

Prerequisites

Java 17+
Maven 3.6+

Installation & Run

# Clone repository
git clone https://github.com/copyboy/html2md.git
cd html2md

# Build
mvn clean package

# Run
java -jar target/html2md.jar

# Access in browser
http://localhost:8090/tool/html2md

๐ŸŒ Try Live Demo

Online Tool: https://api.zhangqingdong.cn/tool/html2md

Just paste your article URL and click convert!


๐Ÿ“– Usage Examples

Single Article

# CSDN Article
https://blog.csdn.net/username/article/details/123456789

# CNBLOG Article  
https://www.cnblogs.com/username/p/123456.html

# WeChat Official Account
https://mp.weixin.qq.com/s/xxxxxxxxxxxxx

Batch Download

# Multiple URLs (comma-separated)
https://blog.csdn.net/user1/article/details/111,
https://www.cnblogs.com/user2/p/222.html,
https://mp.weixin.qq.com/s/xxx

CSDN Category

# Download entire category
https://blog.csdn.net/username/category_8584136.html

๐Ÿ› ๏ธ Tech Stack

  • Backend: Spring Boot 2.x
  • HTML Parser: Jsoup
  • Markdown Converter: Flexmark
  • Web Server: Embedded Tomcat

๐Ÿ“Š Supported Platforms

Platform Status Format Batch Notes
CSDN โœ… MD/HTML โœ… Supports categories
CNBLOG โœ… MD/HTML โœ… Use HTML if MD has issues
WeChat โœ… MD/HTML โœ… Official Account only
Juejin โณ - - Coming soon
Jianshu โณ - - Coming soon

๐Ÿ”ง API Usage

Convert Article

POST http://localhost:8090/api/convert
Content-Type: application/json

{
  "url": "https://blog.csdn.net/xxx/article/details/123",
  "format": "markdown"  // or "html"
}

Response

{
  "success": true,
  "title": "Article Title",
  "content": "# Article Content\n\n...",
  "author": "Author Name"
}

๐ŸŽจ Screenshots

Click to expand

Web Interface:

  • Simple input form
  • Real-time conversion
  • Download button

Output Example:

  • Clean Markdown format
  • Preserved code blocks
  • Maintained image links

๐Ÿค Contributing

Contributions are welcome!

Add New Platform Support

  1. Add new platform enum in HostEnums
  2. Get page content ID selector
  3. Implement parser logic
  4. Add tests
  5. Submit PR

Code Style

# Run tests
mvn test

# Code format
mvn spotless:apply

๐Ÿ“ Changelog

v1.1.0 (Latest)

  • โœจ Added WeChat Official Account support
  • ๐Ÿ› Fixed CNBLOG code block issues
  • ๐Ÿ“ Improved documentation

v1.0.0

  • ๐ŸŽ‰ Initial release
  • โœ… CSDN & CNBLOG support

๐Ÿ™ Acknowledgements


๐Ÿ“„ License

MIT License


๐Ÿ’ฌ Contact & Support


โญ Star History

If you find this project helpful, please give it a star! โญ


Made with โค๏ธ by copyboy


English Version

๐ŸŒ HTML2MD - Blog Article Converter

Convert Chinese blog articles to Markdown/HTML format with ease

What is HTML2MD?

HTML2MD is a Java-based tool that helps you convert blog articles from popular Chinese platforms (CSDN, CNBLOG, WeChat Official Accounts) into clean Markdown or HTML format.

Perfect for:

  • ๐Ÿ“š Content Migration: Move your articles to new platforms
  • ๐Ÿ’พ Backup: Archive your blog posts locally
  • ๐Ÿ“ Reuse: Repurpose content for documentation
  • ๐Ÿ”„ Format Conversion: Convert between HTML and Markdown

Key Features

  1. Multi-Platform Support: Works with CSDN, CNBLOG, and WeChat
  2. Clean Output: Removes ads, comments, and clutter
  3. Batch Processing: Convert multiple articles at once
  4. Live Demo: Try it online without installation
  5. API Available: Integrate into your workflow

Quick Start Guide

# 1. Clone
git clone https://github.com/copyboy/html2md.git

# 2. Build
mvn clean package

# 3. Run
java -jar target/html2md.jar

# 4. Open browser
http://localhost:8090/tool/html2md

Usage

  1. Paste article URL
  2. Select output format (Markdown/HTML)
  3. Click "Convert"
  4. Download result

That's it! ๐ŸŽ‰

Tech Stack

  • Java 17+
  • Spring Boot 2.x
  • Jsoup (HTML parsing)
  • Flexmark (Markdown)

Contributing

PRs welcome! Please:

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push and submit a PR

License

MIT License - see LICENSE file


About

๐Ÿš€ Convert blog articles from CSDN, CNBLOG, WeChat to Markdown/HTML | ไธญๆ–‡ๅšๅฎขๆ–‡็ซ ่ฝฌ Markdown ๅทฅๅ…ท

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors