Notes on franklin's gramma
Franklin syntax
Markdown
\fig{path}
and\figalt{alt}{path}
for figure insertion, in addition to markdown's![alt](full_path)
syntax, the difference is the Franklin version allows relative paths;\figenv{alt}{path}{style}
: new command (defined in config.md) suggested by Franklin tutorials to insert img with control of styles such aswidth|border|text-align
etc.\figdiy{path}{img-features}
: my diy command to insert image\figdiy{/assets/img/bash.svg}{width=100px align="left" }
\textinput{path}
: insert a markdown file\tableinput{headers}{path}
: insert a table from CSV file, if headers option left empty, use the first line of the csv file as table header
using HTML comments
$
should be escaped:\$
=> $HTML entities supported:
→
=> →\\
for line break~~~ <some html things> ~~~
for insert raw html\toc
or\tableofcontents
for TOC => in afranklin-toc
div block, modify.franklin-toc ol
or.franklin-toc li
in CSS for styling, set@def mintoclevel=1
and@def maxtoclevel=3
to control the header levelsboth single and double back-ticks represent inline code (double back-ticks are useful when code contain
`
):"`"
;
no native Admonitions gramma support, I made my own here, but not very productive;
list items must be on the same line due to a limitation of Julia Markdown parser, so code block or table indent to a list item would not happen in Franklin blogs (for now maybe)
~~ strikethrough text ~~
not supported in Franklin: ~~ I should be strikethrough ~~, use~~~<del></del>~~~
instead:I am strikethrough, I wrapped it as a function:\del
in config.md, so I could also do\del{I am strikethrough}
and get:I am strikethrough
Divs and Commands
Using
@@divclass ... @@
to define custom div blocks. Could be nested.
Citations
\biblabel{short}{name}
: create bibliography list with cite linkshort
;\cite{short1, short2}
or\citet{short3}
: will not add parentheses:Some text gui et al.(2022)
\citep{short1, short2}
: will add parentheses:Some text (gui et al.(2022))
In the text, you may refer to \citep{noether15, bezanson17} while in a bibliography section you would have
* \biblabel{noether15}{Noether (1915)} **Noether**, Korper und Systeme rationaler Funktionen, 1915.
* \biblabel{bezanson17}{Bezanson et al. (2017)} **Bezanson**, **Edelman**, **Karpinski** and **Shah**, [Julia: a fresh approach to numerical computing](https://julialang.org/publications/julia-fresh-approach-BEKS.pdf), SIAM review 2017.
In the text, you may refer to (Noether (1915), Bezanson et al. (2017)) while in a bibliography section you would have
Bezanson, Edelman, Karpinski and Shah, Julia: a fresh approach to numerical computing, SIAM review 2017.
define a function that auto add bibliography to the end of the file?
or, auto add bibliography to a temp file, and a new function say
\biblist
to get all bibliography in the temp file?use a BibTex file as database, and use the key as options?
Page variables
@def
:
@def author = "songtaogui"
<!-- if text are multi-lines, they MUST be indented -->
@def some_str = """
abc
def
"""
or define them within +++
block, the content between +++
will be evaluated as julia code, all variables will be consided as page variables.
using {{fill var}}
function to retrieve the page variables: {{fill author}}
@def
, so here we recommend the use of toml inside +++
for var definition.
HTML functions
list of buildin Franklin HTML functions:
Format | Role |
---|---|
{{fill var}} or {{var}} | retrieve the values from var page variables |
{{fill vname rpath}} | place the value of page variable vname defined at rpath where rpath is a relative path like blog/pg1 |
{{redirect /some/other/addr.html}} | adds a redirect page: when a user goes to (baseurl)/some/other/addr.html , they will be redirected to the current page |
{{insert fpath}} | insert the content of the file at fpath where fpath is taken relative to the _layout folder |
{{if var}} ... {{elseif var2}} ... {{else}} ... {{end}} | Conditional blocks |
{{ispage path}} ,{{isnotpage path}} , {{is(not)def var}} , {{is(not)empty var}} | dedicated conditional blocks |
{{for (x,y) in var}} ... {{fill x}} ...{{fill y}} ... {{end}} | For loops, with eg.: var = [(1,2),(3,4)] |
Global page variables
author
prepath
,prefix
,base_path
date_format
date_days
,date_shortdays
,date_(short)months
div_content
ignore
: indicate files should be ignored by Franklin. to ignore a file add it's relative path like"path/to/file.md"
, to ignore a directory end the path with a/
like"path/to/dir/"
..autocode
automath
Refer to other buildin variables here.