Closed johnthagen closed 3 years ago
Looking closer, it looks like the best thing to do would be to expose the extras
attribute out to the user. markdown2
supports this extra
:
* tables: Tables using the same format as GFM
<https://help.github.com/articles/github-flavored-markdown#tables> and
PHP-Markdown Extra <https://michelf.ca/projects/php-markdown/extra/#table>.
Exposing this to the user would allow them to enable whichever extras they need.
Like so:
def md2pdf(pdf_file_path, md_content=None, md_file_path=None,
css_file_path=None, base_url=None, extras=None):
"""
Converts input markdown to styled HTML and renders it to a PDF file.
Args:
pdf_file_path: output PDF file path.
md_content: input markdown raw string content.
md_file_path: input markdown file path.
css_file_path: input styles path (CSS).
base_url: absolute base path for markdown linked content (as images).
Returns:
None
Raises:
ValidationError: if md_content and md_file_path are empty.
"""
if extras is None:
extras = ["cuddled-lists"]
...
I can confirm that setting extras=["cuddled-lists", "tables"]
fixes this issue.
Related to #10
Great! Can you propose a PR?
@jmaupetit Looking at the master
branch more closely, this actually is supported
https://github.com/jmaupetit/md2pdf/blob/b73deee01ffebc08f6883efd52014f7159f8ceee/md2pdf/core.py#L31
But there has not been a released on PyPI in 4 years:
https://pypi.org/project/md2pdf/
Could a new release from master
be pushed to PyPI? That would close this issue.
This is now fixed! https://pypi.org/project/md2pdf/0.5/
Are Extended syntax tables supported? https://www.markdownguide.org/extended-syntax/#tables
Code
Output
Expecting to see a table here:
Version
Python 3.9.1