HTML到降价转换器。

html2md的Python项目详细描述


HTML2md

HTML到降价转换器

安装

pip install -U html2md

用法

作为命令行工具:

# To convert a file.
html2md examples/hello.html

# To convert from stdin.
cat examples/hello.html | html2md

来自python脚本:

importhtml2mdhtml='''<h1>Header</h1><b><i>Hello</i></b> from <code>html2md</code><pre class="py"><code>print('Hello')</code></pre>'''md=html2md.convert(html)print(md)

贡献

克隆存储库

首先,从项目开始。

# Clone your fork into your local machine.# This will create the `origin` remote pointing to your fork.
git clone git@github.com:<your-username>/html2md.git
cd html2md

# Add an `upstream` remote pointing to the original repository.
git remote add upstream git@github.com:davidcavazos/html2md.git

设置您的环境

确保已安装virtualenv

pip install -U virtualenv

创建并激活新的virtualenv

python -m virtualenv env
source env/bin/activate

Note: Once you are all done, you can deactivate it by running deactivate.

安装需求。

pip install -U -r requirements.txt

修改代码

首先,确保你是最新版本的。

git checkout master
git pull upstream master

现在,为您的更改创建一个新分支。 尝试对更改使用简短的描述性名称。

# Create a new branch and change to it.
git checkout -b your-branch

你现在可以修改任何你想要的。

运行测试

确保为任何新功能添加测试或修复。 如果它在新文件中,请将*_test.py前缀附加到该文件。

# To run all the tests.
python setup.py test# To run a specific test suite.# python setup.py test -s <package>.<test_file>.<TestSuite>
python setup.py test -s html2md.convert_test.ConvertTest

# To run a specific test.# python setup.py test -s <package>.<test_file>.<TestSuite>.<test_name>
python setup.py test -s html2md.convert_test.ConvertTest.test_code_block

创建拉取请求

在所有测试通过后,您必须创建一个包含更改的“拉取请求”。 您可以创建一个包含所有更改的提交。

Note: You can check your changes with git status.

# Create a commit and push it to your fork's branch.
git add .
git commit -m 'One line description of your changes'
git push origin your-branch

然后,您可以跟随终端中的链接,或导航到html2md,以创建“拉取请求”。

If you need to add further modifications, you'll have to:

git add .
git commit -m 'One line description of further changes'
git push origin your-branch

Afterwards, it will reflect automatically on the Pull Request.

一旦一切都好了,就可以合并了。

发布新版本

确保安装了更多工具。

pip install -U twine

生成分发存档。

# Make sure there are no previous builds.
rm -rf dist/

# Build the distribution package.
python setup.py sdist bdist_wheel

# Check any problems with the README.
twine check dist/*

Note: It is highly recommended to publish to TestPyPI before publishing to PyPI.

# To upload to TestPyI.
twine upload --repository-url https://test.pypi.org/legacy/ dist/*

# To install from TestPyPI.
pip install --index-url https://test.pypi.org/simple/ --no-deps html2md

If everything is working correctly, go ahead and publish to PyPI.

上传到PyPI

twine upload dist/*

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Java算法:如何对实体进行分组   C语言中的Java X509EncodedKeySpec#   如何修复java lambda筛选器(缺少返回语句)与future   java有没有办法在Swing中以亚像素精度绘制线条?   HV000030:找不到约束“javax”的验证器。验证。限制。大小为“验证类型”的java。util。可选<java。lang.String>'   CQL中语句的java分页状态   在开发时使用applet查看器的java对象相关applet   java如何从Oracle获取时区ID而不是时区偏移量   java递增变量   java JavaFX InvalizationListener或ChangeListener   java使用多个数据包将大量XMP数据插入jpg?   java允许删除请求   java为什么与类同名的方法不需要返回类型?   java数据转换错误转换   java一旦布尔值为真,如何关闭JFrame?   如何将数据写入两个java。木卫一。一次输出流对象?   mysql如何使用java在SQL中划分两列?   java使用Saxon/XQuery设置URI或目录解析器   mysql java。sql。SQLException:无法将值“20200816 17:33:21.690”从第18列转换为时间戳