How to have the Layout convert a Page written in Markdown to HTML (using Zurb Foundation Panini) - zurb-foundation

I am using Zurb's Panini site generator. I am using a CMS that outputs a html file written in markdown to the pages folder. My goal was to have the template file convert the markdown to html.
I've tried to have the markdown get converted before it enters the template file but haven't found a way with the CMS I am using (NetlifyCMS). The CMS also needs to be very user friendly for non-technical users.
<!-- This is the part of the template file -->
<article class="cell medium-5 cell-block-y location-info-container">
<h1 class="location">{{title}}</h1>
{{#markdown}}
{{> body}}
{{/markdown}}
</article>
When running foundation build everything works as expected except for the markdown content is still markdown. I have tried to find a workaround but with no luck so I am open to a solution or workaround. Also, a quick apology in advanced, due to client restrictions I am unable to post links and have the project on a private repository.

You have to add a markdown helper using marked or another markdown library.
https://github.com/zurb/panini/blob/dev/readme.md

Related

Why is my template html file not using bootsrap css?

I'm Sreenesh, a beginner in Django web framework.
I've been facing some problems while doing a project.
this is my
OUTPUT of my django website which is not what i expected it to be.
this is my
HTML CODE from this I think you can say output is not the desired one.
command prompt throws me these 2 errors CMD PROMPT and I'm unable to fix these problems on my own as I'm a self learner.this is my bootstrap files directory as you can see the path I specified in link tag in my html code is right. this is my Settings.py and Url.py. Could anyone help me where i am doing wrong and how to fix these problems so I can get ahead with my project and learn some valuable lessons. Thank you everyone.
Update: this is my folder tree for those who need it for some verifications.
If you are facing some trouble wile using bootstrap in local then use CDN
in your base html file :
Into the <head> tag
<!-- Boostrap css -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/css/bootstrap.min.css"
integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
Just before closing the body tag
<!-- jQuery and Bootstrap js -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/js/bootstrap.bundle.min.js"
integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns"
crossorigin="anonymous"></script>
Try it and let us know the result
You are getting a 404 error (does not exist) when it tries to load bootstrap.min.css. So, it's not in the folder specified by
{% static css/css/bootstrap.min.css %}
(or possibly, there's a file protection problem). Anyway, I think that translates to $BASE_DIR/static/css/css/bootstrap.min.css (using Linux notation, I don't do Windows).
Check that the file is there? And to debug in case I'm wrong, you can get the actual path it's looking for by using the same template tag to generate visible HTML content, or an HTML comment that you can see with your browser view page source
<!-- trying to load bootstrap from {% static css/css/bootstrap.min.css %} -->

R Blogdown with different Rmarkdown outputs

I built a blogdown site using Hugo and it has multiple sections, posts all written in Rmarkdown with outputs designed as html_document. It works fine.
In parallel, I designed an HTML dashboard using Rmarkdown with an output designed as flex_dashboard. It generates an HTML file working fine.
I wanted to integrate the dashboard directly within the building of the site but unfortunately by simply adding the Rmarkdown file in the blogdown structure it knits it as an html document and not as a flex_dashboard. So, I have the content within my website but not at all as dashboard but more like a traditional html_document. So no luck with that :(
I tried then copying the dashboard html under /static/html and create a brand new Rmarkdown just invoking my html within an iframe:
---
output: html_document
---
<link rel="preload" href="/html/OpenDashboard.html" as="document">
<iframe width="100%" height="600" name="iframe" src="/html/OpenDashboard.html"></iframe>
Looked good to me and was pretty happy even in inelegant but performance is bad. It takes a long time to load (+10sec) even if the file is not that big (only 6Mb). Size of the html will grow a lot in the future and I can't hope viewers will wait that long.
I read it was possible to clarify the type of knitting we want within a build.R file but I am clueless on how to specify I want html_document knitting for some Rmarkdowns and flex_dashboard for some others.
To answer your last question: in Section 2.7 of the blogdown book, it mentions that you could use blogdown::build_dir() in R/build.R to build arbitrary Rmd files under the static/ directory.

Linking to url with rmarkdown using Knit Word in Rstudio

Is there an easy way to link to a webpage in rmarkdown without displaying the link?
For example, putting "https://www.google.com/" in a .rmd file renders as the entire website, but I want something analogous to ABC instead.
The html method above, i.e., <a href= ... works when I knit to html, but it does not work when I knit to a word document.
Markdown provides two ways to create a link as you mention (and I suppose that is supported on rmarkdown).
Markdown way:
[ABC](http://example.com)
HTML way:
ABC
The first way is native and the second way is supported since Markdown allows every HTML code.

Taking all javascript from html to page-specific js file

What bit bothers me about django, is that I see in many examples that raw javascript is included in html with <script> tag. I would like to have it in independent files which are included in every page in <head> tag so that html stays clean. So that I will call something like {% add_jscript %}some js code{% endaddjsscript %} anywhere in the template to add js code. After all processing when the page is generated and it will dynamically collects all portions of added js code from processed templates and serve it as one js file.
Some app already does this or am I forced to do this on my own ?
I use django-sekizai (https://github.com/ojii/django-sekizai/) for this kind of thing. If I understand you correctly, I believe that is what you are looking for.
I know I'm a bit late to the party, but another option you could try (shameless plug) is a django app i've been working on which will allow you to inject django variables directly into external javascript files, a la Require.js
django-js-variable-injector

Script Precompile Handlebars Templates in Script Tag

I have a fairly big webapp with lot of templates. I am looking to save time by precompilation of these files.
Currently, I use a script wrapper so that I can load it dynamically and package them in html
<script id="all-domain-users-model-template" type="text/html">
<td></td>
<td>{{domain}}</td>
<td>{{name}}</td>
<td>{{email}}</td>
<td>{{is_account_owner}}</td>
<td>{{#if is_account_owner}}Delete{{/if}}</td>
</script>
There are many many such files. One file can have more than one definition..
I am looking for ideas for a script to read the name in id, parse html, compile and put it back using id.templates in a js file.
I have seen Using pre-compiled templates with Handlebars.js (jQuery Mobile environment) - the accepted answers mentions that the script tag was removed before copying.. But in reality, its almost impossible..
I use grunt-ember-templates to precommpile my ember handlebars templates.
For a good example of this grunt plugin in use check out this example todos application.
It gives a good example of using grunt for your build process, testing, etc, and includes template precompilation.