Merge pull request #22 from SimonIT/ol-start-attribute

Support the start attribute for ordered lists
This commit is contained in:
AlexVonB
2020-08-18 18:44:59 +02:00
committed by GitHub
2 changed files with 6 additions and 1 deletions

View File

@@ -181,7 +181,11 @@ class MarkdownConverter(object):
def convert_li(self, el, text):
parent = el.parent
if parent is not None and parent.name == 'ol':
bullet = '%s.' % (parent.index(el) + 1)
if parent.get("start"):
start = int(parent.get("start"))
else:
start = 1
bullet = '%s.' % (start + parent.index(el))
else:
depth = -1
while el:

View File

@@ -123,6 +123,7 @@ def test_i():
def test_ol():
assert md('<ol><li>a</li><li>b</li></ol>') == '\n1. a\n2. b\n\n'
assert md('<ol start="3"><li>a</li><li>b</li></ol>') == '\n3. a\n4. b\n\n'
def test_p():