-
Notifications
You must be signed in to change notification settings - Fork 43
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
Enable HTML header and footer #35
Comments
How would you use Jinja in the context of that project? I hesitated about the headers and footers, maybe it is better to accept Markdown than HTML... I can change my PR that way. I realised that with my actual code, it is not possible to use |
Just in case, I actually fixed my PR #34 as the footer height calculation from the Weasyprint doc didn't seem to work, made CSS counters for If you still think the header / footer functionality would be better implemented using a template mechanism, you can close my PR, otherwise you can tell me if you want me to implement some changes :) |
By using a template engine, header/footer fragments support would not be hard-coded. Users would be free to include partial templates in a core template for their documents. Those templates could mix Markdown and HTML as Markdown supports raw HTML. WDYT? |
I still don't really understand : the md2pdf workflow, on My PR enables the definition of HTML headers and footers (that could be written using Markdown instead) that are added on every page using WeasyPrint functionalities (as WeasyPrint is actually used for HTML to pdf conversion) : this is what they recommend in their documentation. The headers and footers are computed, if present, to WeasyPrint My implementation, in the end, differs from the one recommended by the WeasyPrint documentation by recomputing headers and footers from each page, and setting If you wanted to solve the same problem using a template engine, if I understand correctly, that template engine would intervene before the HTML to pdf conversion. I didn't find a way to have a repeatable header / footer with WeasyPrint using only HTML and CSS : the
|
Hi @c4ffein thank you for this explanation. I've to admit that I read your PR/issue too quickly and I totally missed your point 😅 Sorry for that 🙏 I'll need more time to review your work, but it looks pretty smart. Thank you again for this. ❤️ |
I keep most of my documentation, both technical and commercial, in Restructured text format. For my needs, adding an header and footer to all pages in the final document is a must, so I've forked @c4ffein 's repo. Please consider accepting PR #34. |
I've seen you've just forked my repo, actually I planned to maintain it if @jmaupetit didn't work on it anymore, but I've seen there was a release in January. Do you think you will include that functionality @jmaupetit ? |
@c4ffein , I'm just looking around to consider replacing RestructuredText with Markdown for my own documentation; at the moment, I have no clear plan on how far I will proceed in this direction. Should you remove support for Python 2, I'm fine with it. I might occasionally send you a PR ... feel free to reject if useless .. I don't mind at all. |
Perfect, actually the evolution I would make would be to have one tool to generate pdfs from any "rich" text format, that would include .rst on the long term. I have too many other things going on for now, but I'll probably do some of the things I already have in mind anyway, and your PRs would be greatly appreciated! |
@c4ffein may I ask: is there a simple way to add the current / total number of pages in the footer ? also, what about enabling the "Issues" tab in your fork ? |
Actually, it happens that was one of my main goals with that PR : you can just use that CSS
I enabled the issues tab, but I'm actually creating a new repo as txt2pdf |
@morlandi I published my first changes on https://github.com/c4ffein/txt2pdf/ I think it is good to keep this repository as is, because I used f-strings and so my codebase is no more compatible with Python <3.6, but you can link your repository to mine if you want @jmaupetit |
@jmaupetit As I see you worked on this project again, would this feature be something you would consider? |
I made a PR ( #34 ) to enable the addition of a html header and footer to all pages, taking most code from Weasyprint documentation.
I made the code work on my machine, did it for my own needs, but decided to share it in case it is helpful.
But now, there is a dependency error on the CI...
https://travis-ci.org/github/jmaupetit/md2pdf/jobs/706486615
I wanted to make a valid PR before asking for review, and I still didn't ask if that functionality is worthy or not, as I already wrote the code I preferred to share it directly. So :
Would you merge that PR? If yes, do you know what makes the CI fail (I don't know tox...)? Otherwise I can still try to fix it, but I'd prefer to do it after you tell me if you would accept the PR or keep your repo as simple as possible.
The text was updated successfully, but these errors were encountered: