Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render Markdown inline #7

Open
captn3m0 opened this issue May 26, 2021 · 4 comments
Open

Render Markdown inline #7

captn3m0 opened this issue May 26, 2021 · 4 comments
Assignees

Comments

@captn3m0
Copy link
Owner

Within the markdown, provide a way to declare pages that get rendered as stand-alone pages as well.

<!-- This only goes in bookmark-->
# Cover

![Cover](cover.pdf)

# Colophon

```
# Hobbit
## There and back again
## By JRR Tolkein
```{: inline=1}

![Foreword](foreword.pdf)

Renders a cover, a single page with the 3 lines as above, and then the foreword. So the colophon ends up linking to the middle text section

@Vonter Vonter self-assigned this Jun 30, 2021
@Vonter
Copy link
Collaborator

Vonter commented Jun 30, 2021

```
# Hobbit
## There and back again
## By JRR Tolkein
```{: inline=1}

Is the {: inline=1} something that would be needed? The triple backticks seem sufficient to me, but I haven't used much markdown.

@captn3m0
Copy link
Owner Author

captn3m0 commented Jul 1, 2021

I'm unsure about this - I don't think it's needed as of yet. The long-term semantics of the project aren't really well thought out and we might have inconsistencies as a result.

Do we want the markdown to reflect the structure or the content? Because if it's just structure, then we can keep it out. But if it's content, and we try to parse things like bold/emphasis/images etc as well (outside of backticks), then it might get complicated without the {inline} part.

There's also concerns with render backticks inside inline text.

Maybe we should write a forward-looking markdown doc that reflects all the possible usecases/edgecases first? I started it here: https://github.com/captn3m0/pystitcher/wiki/All-Features

@Vonter
Copy link
Collaborator

Vonter commented Jan 2, 2022

Looks like I lost track of this sometime a couple of months back and just left it hanging, sorry about that 😅
So I did a bit of research on this and the best way I could find is to use Python-Markdown to convert the Markdown to HTML and then convert the HTML to a PDF using whatever works best for #4
This Markdown -> HTML -> PDF route has been done before (with Weasyprint) and looked like it worked well.

@captn3m0
Copy link
Owner Author

fpdf2 has a guide for generating markdown->HTML with mistletoe, and then generating a PDF from there: https://py-pdf.github.io/fpdf2/CombineWithMistletoeoToUseMarkdown.html

It just looks so ugly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants