Skip to content

Commit

Permalink
fix: rendered table html should be lines instead of a single str
Browse files Browse the repository at this point in the history
  • Loading branch information
drmingdrmer committed Sep 15, 2024
1 parent 9a0bac9 commit 343e3bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions md2zhihu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,16 @@ def to_plaintext(mdrender, rnode):
return [escape(n['text'])]


def table_to_barehtml(mdrender, rnode):
def table_to_barehtml(mdrender, rnode) -> List[str]:
# create a markdown render to recursively deal with images etc.
mdr = MDRender(mdrender.conf, platform=importer)

md = mdr.render_node(rnode)
md = '\n'.join(md)

tablehtml = k3down2.convert('table', md, 'html')
return [tablehtml, '']
table_html = k3down2.convert('table', md, 'html')
table_html = table_html.split("\n") + ['']
return table_html


def table_to_jpg(mdrender, rnode):
Expand Down
3 changes: 2 additions & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ python setup.py install

# PYTHONPATH="$(cd ..; pwd)" pytest -x -v
# PYTHONPATH="$(cd ..; pwd)" pytest -x -v -k test_simple
PYTHONPATH="$(cd ..; pwd)" pytest -x -v --show-capture=all -k test_minimal_mistake
# PYTHONPATH="$(cd ..; pwd)" pytest -x -v --show-capture=all -k test_minimal_mistake
PYTHONPATH="$(cd ..; pwd)" pytest -x -v --show-capture=all -k test_github

0 comments on commit 343e3bf

Please sign in to comment.