Open ahcyip opened 3 years ago
I was just about to write the same. 1) I also finally got the motivation to make a minimal website. Thanks for the package!
2) Same issue as @ahcyip. (e.g. line 39 in jolla_blue.html). Some system details that might be of help (?):
OS Version : Windows 10 x64
R Version : 4.0.3
rmarkdown : 2.5
knitr : 1.30
pandoc : 2.7.3
Maybe this has something to do with the pandoc
version? I get the same error with release version of RStudio but not with the preview release.
> rmarkdown::pandoc_version()
[1] ‘2.7.3’
> rmarkdown::pandoc_version()
[1] ‘2.11.2’
I also think this is a pandoc version issue. If you install the latest version of pandoc you can use rmarkdown::find_pandoc()
to make rmarkdown aware of your latest pandoc version. I just opened a question on stackoverflow with a reproducible example to try to solicit other solutions.
remotes::install_github("seankross/postcards#8")
That makes it work for me! This is on RStudioServer which is pandoc 2.7.3.
Just to confirm: I also got it working with the latest pandoc version.
I now switched back to release version of RStudio and
rmarkdown::pandoc_version()
[1] ‘2.7.3’
With postcards#8 I can succesfully knit the document. However, the LinkedIn/Twitter Boxes below the horizontal line are not rendered any longer.
processing file: Untitled.Rmd
|......................................................................| 100%
ordinary text without R code
output file: Untitled.knit.md
"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS Untitled.utf8.md --to html4 --from markdown+tex_math_single_backslash-autolink_bare_uris
--output Untitled.html
--lua-filter "C:\Users\Peter\Documents\R\win-library\4.0\rmarkdown\rmarkdown\lua\pagebreak.lua"
--lua-filter "C:\Users\Peter\Documents\R\win-library\4.0\rmarkdown\rmarkdown\lua\latex-div.lua"
--email-obfuscation none --standalone --section-divs
--template "C:\Users\Peter\Documents\R\win-library\4.0\postcards\pandoc_templates\jolla-blue-pandoc-old.html"
--highlight-style pygments
--include-in-header "C:\Users\Peter\AppData\Local\Temp\Rtmpuu332R\rmarkdown-str38906ae12040.html"
Output created: Untitled.html
Yes, this works for me too.... the error is not thrown.
However, the resulting Links <ul>
block is empty and the HTML in the browser looks like the CSS has not linked up.
Pandoc externalised the doctemplates functionality - https://github.com/jgm/doctemplates
The functionality for pipes and filters was cleaned in 2.8.
"Pandoc templates now support a number of new features that have been added in doctemplates: notably, elseif, it, partials, filters, and syntax to control nesting and reflowing of text. These changes make pandoc more suitable out of the box for generating plain-text documents from data in YAML metadata. It can create enumerated lists and even tabular structures." Pandoc Releases: 2.8
PS: Adding data-external="1" to the <img>
tag in the template allows one to have images that are separate from the standalone HTML. Which is great if you have images that need updating frequently or being re-used on the website elsewhere.
Adding data-external="1" to the bootstrap link tag in the header, fixed the template for me. Trestles now shows up as intended, before this, the CSS was not applied. (This perhaps defeats the purpose of self-contained HTML, but those are links to external bootstrap CSS anyway. (But not yet these links)
This sorts it out for me completely. (Posted to the stackoverflow as well) - although the links block is not as neat/compact as in your original version; it remains flexible.
Pandoc 2.7.3 can't handle the 'pairs' in 2.8, but you can define lists in the header YAML. (By explicit specification of the nested variables within the links object - (requires two tabs before 'url').
---
title: "Frank Hermosillo"
image: "frank.jpg"
links:
- site: LinkedIn
url: "https://linkedin.com/"
- site: Twitter
url: "https://twitter.com/"
- site: GitHub
url: "https://github.com/"
- site: Email
url: "mailto:email@email.com"
output:
postcards::trestles
---
Then in the template you can just refer to the field names:
<ul class="list-inline">
$for(links)$
<li class="list-inline-item">
<a href=$links.url$>
<button type="button" class="btn btn-outline-dark">
To $links.site$
</button>
</a>
</li>
$endfor$
</ul>
Does that work for later versions as well?
I knitted to index.html - in a folder - then in RStudio (because this is a Git Project) committed and pushed to Git. My Git is hooked up to Netlify and Netlify is pointed to the same folder (so all that is automated [as recommended]):
Hi all, would you mind trying out #10 ?
remotes::install_github("seankross/postcards#10")
Thanks @zorgster for these ideas.
Thanks - it knits without error for me now (and I didn't change anything with my RStudio/packages/pandoc)
Yes, for me too. Jolla-Blue and Trestles both knitted without error.
I see the CSS, scripts and image have not been encoded in the HTML and there's no 'data-external' attribute in the html... is that achieved elsewhere?
This will finally get me to make a website! But I ran into this error:
processing file: test.Rmd |......................................................................| 100% ordinary text without R code
[...]
"template" (line 34, column 26): unexpected "/" expecting "." or ")$" Error: pandoc document conversion failed with error 5 Execution halted
which points to the / in $for(it/pairs)$