summaryrefslogtreecommitdiffstats
path: root/Documentation/process
AgeCommit message (Expand)Author
2020-08-13Merge tag 'docs-5.9-2' of git://git.lwn.net/linuxLinus Torvalds
2020-08-11docs: Correct the release date of 5.2 stableBilly Wilson
2020-08-04Merge tag 'docs-5.9' of git://git.lwn.net/linuxLinus Torvalds
2020-08-04Merge tag 'uninit-macro-v5.9-rc1' of git://git.kernel.org/pub/scm/linux/kerne...Linus Torvalds
2020-07-23docs: process: Add an example for creating a fixes tagTom Rix
2020-07-23docs: process/index.rst: Fix reference to nonexistent documentDaniel W. S. Almeida
2020-07-16docs: deprecated.rst: Add uninitialized_var()Kees Cook
2020-07-10Merge tag 'inclusive-terminology' of git://git.kernel.org/pub/scm/linux/kerne...Linus Torvalds
2020-07-08Documentation: update for gcc 4.9 requirementRandy Dunlap
2020-07-03CodingStyle: Inclusive TerminologyDan Williams
2020-06-26Merge branch 'mauro' into docs-nextJonathan Corbet
2020-06-26docs: move other kAPI documents to core-apiMauro Carvalho Chehab
2020-06-26Replace HTTP links with HTTPS ones: Documentation/processAlexander A. Klimov
2020-06-19docs: deprecated.rst: Add zero-length and one-element arraysGustavo A. R. Silva
2020-06-10Merge branch 'rwonce/rework' of git://git.kernel.org/pub/scm/linux/kernel/git...Linus Torvalds
2020-06-10Merge tag 'docs-5.8-2' of git://git.lwn.net/linuxLinus Torvalds
2020-06-10Documentation/CodingStyle: Fix duplicate "are" typoGeert Uytterhoeven
2020-06-08Replace HTTP links with HTTPS ones: documentationAlexander A. Klimov
2020-06-08docs: Update the location of the LF NDA programJonathan Corbet
2020-06-04Merge tag 'devicetree-for-5.8' of git://git.kernel.org/pub/scm/linux/kernel/g...Linus Torvalds
2020-06-01Merge tag 'docs-5.8' of git://git.lwn.net/linuxLinus Torvalds
2020-05-31checkpatch/coding-style: deprecate 80-column warningJoe Perches
2020-05-25docs: sysctl/kernel: document unaligned controlsStephen Kitt
2020-05-04docs: dt: convert submitting-patches.txt to ReST formatMauro Carvalho Chehab
2020-04-20docs: filesystems: fix renamed referencesMauro Carvalho Chehab
2020-04-20docs: fix broken references to text filesMauro Carvalho Chehab
2020-04-15compiler/gcc: Raise minimum GCC version for kernel builds to 4.8Will Deacon
2020-04-09Documentation/changes: Raise minimum supported binutils version to 2.23Borislav Petkov
2020-04-03Merge tag 'char-misc-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/gi...Linus Torvalds
2020-03-30Merge tag 'docs-5.7' of git://git.lwn.net/linuxLinus Torvalds
2020-03-26Documentation: provide IBM contacts for embargoed hardwareChristian Borntraeger
2020-03-20docs: deprecated.rst: Add BUG()-familyKees Cook
2020-03-10Documentation: management-style: Fix formatting of emphsized wordJonathan Neuschäfer
2020-03-10docs: Remove :c:func: from process/deprecated.rstJonathan Corbet
2020-03-10docs: deprecated.rst: Clean up fall-through detailsKees Cook
2020-03-10docs: deprecated.rst: Add %p to the listKees Cook
2020-03-02docs: kernel-docs: Remove "Here is its" at the end of linesJonathan Neuschäfer
2020-02-19Documentation: bring process docs up to dateTony Fischetti
2020-02-19Replace dead urls with active urls for MuttBhaskar Chowdhury
2020-02-13Documentation/process: Swap out the ambassador for CanonicalTyler Hicks
2020-02-10Documentation/process: Change Microsoft contact for embargoed hardware issuesJames Morris
2020-02-10embargoed-hardware-issues: drop Amazon contact as the email address now bouncesGreg Kroah-Hartman
2020-02-10Documentation/process: Add Arm contact for embargoed HW issuesGrant Likely
2020-02-07Merge tag 'docs-5.6-2' of git://git.lwn.net/linuxLinus Torvalds
2020-02-05Documentation: changes.rst: update several outdated project URLsRandy Dunlap
2020-01-29Merge tag 'docs-5.6' of git://git.lwn.net/linuxLinus Torvalds
2020-01-14Documentation/process: Add Amazon contact for embargoed hardware issuesDavid Woodhouse
2020-01-04Documentation: riscv: add patch acceptance guidelinesPaul Walmsley
2019-12-30docs/zh_CN: add Chinese version of embargoed hardware issuesAlex Shi
2019-12-19Process: provide hardware-security list detailsKonstantin Ryabitsev
ned in the `templates/shortcodes` directory or a built-in one that can be used in a Markdown file. If you want to use something similar to shortcodes in your templates, try [Tera macros](https://tera.netlify.com/docs/templates/#macros). ## Writing a shortcode Let's write a shortcode to embed YouTube videos as an example. In a file called `youtube.html` in the `templates/shortcodes` directory, paste the following: ```jinja2 <div {% if class %}class="{{class}}"{% endif %}> <iframe src="https://www.youtube.com/embed/{{id}}{% if autoplay %}?autoplay=1{% endif %}" webkitallowfullscreen mozallowfullscreen allowfullscreen> </iframe> </div> ``` This template is very straightforward: an iframe pointing to the YouTube embed URL wrapped in a `<div>`. In terms of input, this shortcode expects at least one variable: `id`. Because the other variables are in an `if` statement, they are optional. That's it. Zola will now recognise this template as a shortcode named `youtube` (the filename minus the `.html` extension). The Markdown renderer will wrap an inline HTML node such as `<a>` or `<span>` into a paragraph. If you want to disable this behaviour, wrap your shortcode in a `<div>`. Shortcodes are rendered before the Markdown is parsed so they don't have access to the table of contents. Because of that, you also cannot use the `get_page`/`get_section`/`get_taxonomy` global functions. It might work while running `zola serve` because it has been loaded but it will fail during `zola build`. ## Using shortcodes There are two kinds of shortcodes: - ones that do not take a body, such as the YouTube example above - ones that do, such as one that styles a quote In both cases, the arguments must be named and they will all be passed to the template. Lastly, a shortcode name (and thus the corresponding `.html` file) as well as the argument names can only contain numbers, letters and underscores, or in Regex terms `[0-9A-Za-z_]`. Although theoretically an argument name could be a number, it will not be possible to use such an argument in the template. Argument values can be of one of five types: - string: surrounded by double quotes, single quotes or backticks - bool: `true` or `false` - float: a number with a decimal point (e.g., 1.2) - integer: a whole number or its negative counterpart (e.g., 3) - array: an array of any kind of value, except arrays Malformed values will be silently ignored. Both types of shortcode will also get either a `page` or `section` variable depending on where they were used and a `config` variable. These values will overwrite any arguments passed to a shortcode so these variable names should not be used as argument names in shortcodes. ### Shortcodes without body Simply call the shortcode as if it was a Tera function in a variable block. All the examples below are valid calls of the YouTube shortcode. ```md Here is a YouTube video: {{/* youtube(id="dQw4w9WgXcQ") */}} {{/* youtube(id="dQw4w9WgXcQ", autoplay=true) */}} An inline {{/* youtube(id="dQw4w9WgXcQ", autoplay=true, class="youtube") */}} shortcode ``` Note that if you want to have some content that looks like a shortcode but not have Zola try to render it, you will need to escape it by using `{{/*` and `*/}}` instead of `{{` and `}}`. ### Shortcodes with body Let's imagine that we have the following shortcode `quote.html` template: ```jinja2 <blockquote> {{ body }} <br> -- {{ author}} </blockquote> ``` We could use it in our Markdown file like so: ```md As someone said: {%/* quote(author="Vincent") */%} A quote {%/* end */%} ``` The body of the shortcode will be automatically passed down to the rendering context as the `body` variable and needs to be on a new line. If you want to have some content that looks like a shortcode but not have Zola try to render it, you will need to escape it by using `{%/*` and `*/%}` instead of `{%` and `%}`. You won't need to escape anything else until the closing tag. ## Built-in shortcodes Zola comes with a few built-in shortcodes. If you want to override a default shortcode template, simply place a `{shortcode_name}.html` file in the `templates/shortcodes` directory and Zola will use that instead. ### YouTube Embed a responsive player for a YouTube video. The arguments are: - `id`: the video id (mandatory) - `class`: a class to add to the `<div>` surrounding the iframe - `autoplay`: when set to "true", the video autoplays on load Usage example: ```md {{/* youtube(id="dQw4w9WgXcQ") */}} {{/* youtube(id="dQw4w9WgXcQ", autoplay=true) */}} {{/* youtube(id="dQw4w9WgXcQ", autoplay=true, class="youtube") */}} ``` Result example: {{ youtube(id="dQw4w9WgXcQ") }} ### Vimeo Embed a player for a Vimeo video. The arguments are: - `id`: the video id (mandatory) - `class`: a class to add to the `<div>` surrounding the iframe Usage example: ```md {{/* vimeo(id="124313553") */}} {{/* vimeo(id="124313553", class="vimeo") */}} ``` Result example: {{ vimeo(id="124313553") }} ### Streamable Embed a player for a Streamable video. The arguments are: - `id`: the video id (mandatory) - `class`: a class to add to the `<div>` surrounding the iframe Usage example: ```md {{/* streamable(id="92ok4") */}} {{/* streamable(id="92ok4", class="streamble") */}} ``` Result example: {{ streamable(id="92ok4") }} ### Gist Embed a [Github gist](https://gist.github.com). The arguments are: - `url`: the url to the gist (mandatory) - `file`: by default, the shortcode will pull every file from the URL unless a specific filename is requested - `class`: a class to add to the `<div>` surrounding the iframe Usage example: ```md {{/* gist(url="https://gist.github.com/Keats/e5fb6aad409f28721c0ba14161644c57") */}} {{/* gist(url="https://gist.github.com/Keats/e5fb6aad409f28721c0ba14161644c57", class="gist") */}} ``` Result example: {{ gist(url="https://gist.github.com/Keats/e5fb6aad409f28721c0ba14161644c57") }}