Open PlushBeaver opened 2 years ago
👍🏻 I would like to render $\LaTeX$ to pdf as in HTML* some parts get omitted such as \maketitle
.
*Using RENDER_COMMAND = "timeout 30s pandoc -f latex -t html --self-contained --template /etc/gitea/basic.html"
with basic.html
only containing $body$
Then again I am not sure am I doing it at all correctly 😅
If we have a generic HTML to PDF, all the requirements could be resolved.
@lunny, it is not about generating PDF, it's about rendering externally-generated PDF in Gitea. As described, and I did so, it's possible to write an external rendered that generates a PDF file and outputs <iframe (attributes) src="(URL prefix)/viewer.html?file=(PDF URL)">
. It will show an iframe with PDF rendered alright by PDF.js in modern browsers. But there are bits that cannot be solved well without Gitea integration:
(attributes)
depend on the Gitea HTML template, the most important are width and height, style may be relevant.(URL prefix)
depends on the Gitea public URL.(PDF URL)
must be accessible according to the permissions configured in Gitea.Then again I am not sure am I doing it at all correctly 😅
I was not doing it correctly. The solution was to pandoc -D html
and pick what I wanted to basic.html
expanding from $body$
to
$for(include-before)$
$include-before$
$endfor$
$if(title)$
$title$
$if(subtitle)$
$subtitle$
$endif$
$for(author)$
$author$
$endfor$
$if(date)$
$date$
$endif$
$endif$
$if(toc)$
$idprefix$TOC
$if(toc-title)$
$toc-title$
$endif$
$table-of-contents$
$endif$
$body$
$for(include-after)$
$include-after$
$endfor$
which may bring out more issues or having too much information once I use it more. For example title and author currently appear as normal text.
Regardless of having mostly resolved my $\LaTeX$ rendering issue, I think rendering pdf instead is going to look better and closer to what the document authors wish for.
I completely agree on this! Allowing external PDF rendering would basically mean, I don't need to compile my Latex code on my computer to view a PDF. I could just open the .tex file in the web GUI and see the same file, I created on my local environment. It would very much help me preparing for exams!
Currently a lot of math stuff is very broken and not rendered correctly (only shows the tex code). Paragraphs also not reflect the pdf at all.
Just rendering the pdf would fix those issues.
I would be willing to pay a bounty on such a PR in case anyone is interested.
Just wanted to add support for this - this would be a very welcome addition. proper latex preview would be a game changer.
Feature Description
In short: allow external renderers to output PDF, automatically display it using pdf.js. Use case: PowerPoint (pptx) files cannot be easily converted to HTML, however, they can be quality printed to PDF. Printing files of a custom format to PDF may be a good alternative to a lossy conversion to HTML for some other formats too. I thought about working around this by outputting
<iframe ... src=".../viewer.html?file=...">
from a renderer, but it's a hack.