Skip to main content

This will convert the content part of html into a markdown file.

Project description

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 文件

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

h2md-1.0.3.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

h2md-1.0.3-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file h2md-1.0.3.tar.gz.

File metadata

  • Download URL: h2md-1.0.3.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for h2md-1.0.3.tar.gz
Algorithm Hash digest
SHA256 0b7fff5a90cd0dd38c60ee09af88f66a9175c5d2b7f41badeb46023b908aac19
MD5 ea1e70155076124627940e267b5d57a6
BLAKE2b-256 60687743581ddc5bd37a27487f075691ac763997bff9465b744d8a428c84a898

See more details on using hashes here.

File details

Details for the file h2md-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: h2md-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for h2md-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d6a86331609e66764d082f5d01cc642ed568b34013138c282b5fa2d0573eac91
MD5 26d63efacea8bfeea9c68f5928679ec5
BLAKE2b-256 639110a7c213ea14e04a243bd4329f182b5b61e95cb23abcfa7eb791696c10b9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page