欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

html转换md,转换HTML到Markdown – tomd

程序员文章站 2022-04-09 21:41:50
...

tomd

When crawling online articles such as news, blogs, etc. I want to save them in markdown files but not databases. Tomd has the ability of converting a HTML that converted from markdown. If a HTML can’t be described by markdown, tomd can’t convert it right. Tomd is a python tool.

Installation

pip install tomd

Getting Started

Input

import tomd

tomd.Tomd('

h1

').markdown

# or

tomd.convert('

h1

')

Output

# h1

Usage

from tomd import Tomd

html="""

h1

h2

h3

h4

h5
h6

paragraph

link

html转换md,转换HTML到Markdown – tomdimg

  • 1
  • 2
  • 3
  1. 1
  2. 2
  3. 3
blockquote

inline code

block code

del

bold

italic

bold italic


th1th2

tdtdtdtd

"""

Tomd(html).markdown

Result

# h1

## h2

### h3

#### h4

##### h5

###### h6

paragraph

[link](https://github.com)

![img](https://github.com)

- 1

- 2

- 3

1. 1

1. 2

1. 3

> blockquote

`inline code`

block code

~~del~~

**bold**

*italic*

***bold italic***

---

|th1|th2

|------

|td|td

|td|td

相关标签: html转换md