This will convert the content part of html into a markdown file.
Project description
h2md
本项目目的是将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 hashes)
Built Distribution
h2md-1.0.3-py3-none-any.whl
(12.5 kB
view hashes)