Skip to main content

h2md

Build Status PyPI GitHub repo size GitHub PyPI - Python Version Twitter Follow

本项目目的是将html中正文部分转化为markdown文件,部分参考自 html2md,我把实现方式全改了,第一个 Python 项目,希望能给大家带来帮助。

安装

pip install -U h2md

用法

使用命令行工具:

# 转换一个文件
h2md examples/hello.html

# 从标准输入读取文件进行转换
cat examples/hello.html | h2md

使用 Python 脚本:

import h2md

html = '''
<h1>Header</h1>
<b><i>Hello</i></b> from <code>h2md</code>
<pre class="py"><code>
print('Hello')
</code></pre>
'''

md = h2md.convert(html)
print(md)

最时髦的用法:

注:使用此方法邮箱可能被保护

curl -o- https://mydream.ink/archive/iaas-faas-serverless/ | h2md # 标准输出
curl -o- https://mydream.ink/archive/iaas-faas-serverless/ | h2md > xx.md # 输出到 md 文件
curl -o- https://mydream.ink/archive/iaas-faas-serverless/ | h2md >> xx.md # 追加到 md 文件

Metadata

Release files for h2md 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for h2md 1.0.3
File Size Uploaded
h2md-1.0.3.tar.gz 6.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for h2md 1.0.3
File Interpreter ABI Platform
h2md-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 18.7 kB

Release files / h2md-1.0.3.tar.gz

Download URL h2md-1.0.3.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0b7fff5a90cd0dd38c60ee09af88f66a9175c5d2b7f41badeb46023b908aac19
BLAKE2b-256 checksum
How to use checksums
60687743581ddc5bd37a27487f075691ac763997bff9465b744d8a428c84a898
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.3

Release files / h2md-1.0.3-py3-none-any.whl

Download URL h2md-1.0.3-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d6a86331609e66764d082f5d01cc642ed568b34013138c282b5fa2d0573eac91
BLAKE2b-256 checksum
How to use checksums
639110a7c213ea14e04a243bd4329f182b5b61e95cb23abcfa7eb791696c10b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.3

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.4

2 release files

0.1.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page