vb64 / markdown-pdf

Markdown to pdf renderer
MIT License
22 stars 2 forks source link

TypeError: '>' not supported between instances of 'str' and 'int' #20

Closed cniebla closed 2 months ago

cniebla commented 2 months ago

Version: markdown_pdf 1.2 (pip install markdown-pdf, with Python 3.12.3 on AMD64)

Error while trying to save a PDF:

Traceback (most recent call last):
  File "app.py", line 64, in <module>
    pdf.save("result.pdf")
  File "/home/user/app/.venv/lib/python3.12/site-packages/markdown_pdf/__init__.py", line 82, in save
    if self.toc_level > 0:
       ^^^^^^^^^^^^^^^^^^
TypeError: '>' not supported between instances of 'str' and 'int'

Steps to reproduce:

app.py:

from markdown_pdf import MarkdownPdf

[OTHER CODE]

pdf = MarkdownPdf(result)
pdf.meta["title"] = "Title"
pdf.meta["author"] = "Author"
pdf.save("result.pdf")

$ python app.py

cniebla commented 2 months ago

So sorry, I missunderstood the code. Resolved by creating a section with the result.