Skip to content

Commit

Permalink
feat(artile tag and section tag): 添加对<article>和<section>的支持
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerry Chan committed Jul 17, 2019
1 parent 2e6624e commit 98473e4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ print(md)

最时髦的用法:

> 注:使用此方法邮箱可能被保护
```bash
curl -o- https://mydream.ink/archive/iaas-faas-serverless/ | h2md # 标准输出
curl -o- https://mydream.ink/archive/iaas-faas-serverless/ | h2md > xx.md # 输出到 md 文件
Expand Down
4 changes: 3 additions & 1 deletion h2md/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
'h5': '\n##### {}\n',
'h6': '\n###### {}\n',
'hr': '\n\n---\n',
'div': '{}'
'div': '{}',
'article': '{}',
'section': '{}'
},
'intent': {
'p': '\n{}{}\n',
Expand Down
5 changes: 5 additions & 0 deletions h2md/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ def test_paragraph(self):
])
self.assertEqual(convert(html), expected)

def test_block_normal(self):
html = 'ABCD<article>EFG<section>HIJ</section></article>'
expected = 'EFGHIJ'
self.assertEqual(convert(html), expected)

def test_quotes(self):
html = 'Quotes<blockquote>blockquote</blockquote>'
expected = '\n'.join([
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

setup(
name="h2md",
version="1.0.0",
version="1.0.1",
author="Jerry Chan(陈家俊)",
author_email="jerry@mydream.ink",
description="This will convert the content part of html into a markdown file.",
Expand Down

0 comments on commit 98473e4

Please sign in to comment.