rlesur / weasydoc Goto Github PK
View Code? Open in Web Editor NEWConvert R Markdown to PDF Using Weasyprint (or Prince XML)
License: GNU General Public License v3.0
Convert R Markdown to PDF Using Weasyprint (or Prince XML)
License: GNU General Public License v3.0
Some pandoc
variables are implemented in LaTeX
output format and not in HTML5
output format (see https://pandoc.org/MANUAL.html#variables-set-by-pandoc):
This could be implemented through a customised pandoc
template.
Do you think it could be possible to have access to font-awesome icons ?
By trying this 1) rstudio/rmarkdown#813 or this https://github.com/rstudio/fontawesome, I was able to add icons in the html document but they are absent in the pdf document with the weasyprint engine.
With Prince, only the 2) option works!
Maybe it's an issue for HTML
to PDF
converters rather than an issue for your package...
It would be great if the user could add a post processor to any output format. This would be a smooth mean to generate a pdf
.
Using the hpdf_document
output format with the WeasyPrint
engine on Windows (7 or 10), the pdf is ugly.
There is no problem on Debian or Ubuntu.
Not tested on mac.
The hpdf_document
format looks good on windows using Prince
engine.
It seems there is a bug in the WeasyPrint windows version, but I do not understand what is the problem.
Produce a minimal example before opening an issue in the WeasyPrint project.
Thanks to @BenjaminLouis for the issue.
By default, pandoc
creates a footnotes section
element at the end of the document.
The CSS Generated Content for Paged Media Module adopts a different definition.
Proposal: create a custom class .footnote
that would be applied through pandoc's bracketed spans.
Another idea would be to create a pandoc filter for Note
CSS Paged Media is widely unknown from the R community. This package should provide a tutorial.
Webtex service offers several options (fonts, font sizes...) that could be implemented.
WeasyPrint installation is cumbersome.
The README file should contain a short installation guide that detail both the WeasyPrint and Prince XML install and the docker install.
Trying a very simple example.
---
title: Test
output:
weasydoc::hpdf_document
---
I get the following error when I knit.
output file: test2.knit.md
sh: 1: weasyprint: not found
Error: Document conversion failed with error 127
In addition: Warning message:
In system2(command = engine, args = args) : error in running command
Execution halted
But weasyprint
command works fine in the terminal. Not sure why R can't seem to find it. I have tried restarting R, RStudio and the system. Is there some way way to specify a path to the executable? Or perhaps you see something that I don't.
Hi Romain,
I found some issues with table display using {kable} and {kableExtra} packages and inserting icons in the table. You'll find explanation and reprex here : https://github.com/BenjaminLouis/reprex-weasydoc/tree/master/issue%2312.
Without details, the issues are :
R
chunk with the table is in a CSS chunk, i.e. ::::{.my-class}
R_chink_with_kable
:::
you have to either use the html
format with htmltools::HTML()
function or use the markdown
format in the kable()
function
markdown
format but then you can't use the kableExtra
package to pimp your tableThese observation works only for linux and WeasyPrint. Not tested on windowns and with Prince XML
weasyprint
and prince
can attach a file in the resulting pdf
.
Therefore, the original Rmd
file can be attached in the final pdf
.
See http://weasyprint.readthedocs.io/en/latest/api.html#cmdoption-a
and https://www.princexml.com/doc/command-line/#cmd-pdf
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.