Movatterモバイル変換


[0]ホーム

URL:


franklin
Franklin Logo
Page source|GitHub Repository

Building static websites in Julia

Franklin is a simple, customisable static site generator oriented towards technical blogging and light, fast-loading pages.

Key features

click on the '✓' sign to know more

  • Augmented markdown allowing definition of LaTeX-like commands,

  • Easy inclusion of user-defined div-blocks,

  • Maths rendered viaKaTeX, code viahighlight.js both can be pre-rendered,

  • Can live-evaluate Julia code blocks,

  • Live preview of modifications,

  • Simple optimisation step to compress and pre-render the website,

  • Simple publication step to deploy the website,

  • Straightforward integration withLiterate.jl.

⚠ Note
If you already have experience with Franklin and just want to keep an eye on (new) tips and tricks, have a look at the shortdemos

Quick start

To install Franklin with Julia≥ 1.3,

(v1.6) pkg> add Franklin

You can then just try it out:

julia> using Franklinjulia> newsite("mySite", template="pure-sm")✓ Website folder generated at "mySite" (now the current directory).→ Use serve() from Franklin to see the website in your browser.julia> serve()→ Initial full pass...→ Starting the server...✓ LiveServer listening on http://localhost:8000/ ...  (use CTRL+C to shut down)

If you navigate to that URL in your browser, you will see the website. If you then openindex.md in an editor and modify it at will, the changes will be live rendered in your browser. You can also inspect the filemenu1.md which offers more examples of what Franklin can do.

Installing optional extras

Franklin allows a post-processing step to compress HTML and CSS and pre-render code blocks and math environments. This requires a couple of dependencies:

  • python3 for the minification of the site,

  • node.js for the pre-rendering of KaTeX and code highlighting.

You will then need to installhighlight.js, which you should do from Julia using theNodeJS.jl package:

julia> using NodeJSjulia> run(`sudo $(npm_cmd()) install highlight.js`)

Note: a key advantage of usingNodeJS for this instead of usingnpm yourself is that it puts the libraries in the "right place" for Julia to find them.

Assuming you havepython3, Franklin will try to install the python packagecss_html_js_minify if viapip3.

⚠ Note
Youdon't have to install these libraries and you can safely ignore any message suggesting you install those. Also note that if you do want this but it doesn't work locally due to somenode weirdness or related, things will likely still work if you use GitHub to deploy.
© Thibaut Lienart. Last modified: April 16, 2024. Website built withFranklin.jl and theJulia programming language.

[8]ページ先頭

©2009-2025 Movatter.jp