Skip to content

Commit

Permalink
Switch to markdown (not 2) and pymdown-extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
jmaupetit committed Jan 23, 2024
1 parent ae2b84b commit 67e05cb
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 15 deletions.
2 changes: 1 addition & 1 deletion md2pdf/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import click

from md2pdf.core import md2pdf
from .core import md2pdf

logger = logging.getLogger(__name__)

Expand Down
7 changes: 6 additions & 1 deletion md2pdf/conf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
"""Configuration for md2pdf."""

MARKDOWN_EXTRAS: list = ["cuddled-lists", "tables", "footnotes"]
MARKDOWN_EXTRAS: list = [
"markdown.extensions.tables",
"pymdownx.magiclink",
"pymdownx.betterem",
"pymdownx.superfences",
]
4 changes: 2 additions & 2 deletions md2pdf/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import frontmatter
from jinja2 import Template
from markdown2 import markdown
from markdown import markdown
from weasyprint import CSS, HTML

from .conf import MARKDOWN_EXTRAS
Expand Down Expand Up @@ -57,7 +57,7 @@ def md2pdf(
# Render the template
raw = Template(template).render(context)

raw_html = markdown(raw, extras=extras)
raw_html = markdown(raw, extensions=extras)

# Weasyprint HTML object
if base_url is None:
Expand Down
74 changes: 64 additions & 10 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ md2pdf = "md2pdf.__main__:cli.cli"
[tool.poetry.dependencies]
python = "^3.8"
weasyprint = "^60.2"
markdown2 = "^2.4.12"
click = "^8.1.7"
pygments = "^2.17.2"
python-frontmatter = "^1.1.0"
jinja2 = "^3.1.3"
markdown = "^3.5.2"
pymdown-extensions = "^10.7"

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.4"
Expand Down

0 comments on commit 67e05cb

Please sign in to comment.