Nikola Demo Info Pages
Table of Contents
1 Nikola Handbook
1.2 Images versus Figures
A "figure" consists of image data (including image options), an optional caption (a single paragraph), and an optional legend (arbitrary body elements). For page-based output media, figures might float to a different position if this helps the page layout.
1.4 Built-in shortcodes
-
emoji Insert an emoji. For example:
{{% emoji crying_face %}}
😢-
GitHub - shanraisshan/EmojiCodeSheet: Your first stop for developing emoji keyboards for any platform, using any language. - github.com/ [[https://github.com/shanraisshan/EmojiCodeSheet]] (20200419_045755)
EmojiCodeSheet/json/string at master · shanraisshan/EmojiCodeSheet · GitHub - github.com/ [[https://github.com/shanraisshan/EmojiCodeSheet/tree/master/json/string]] (20200419_050310)
Files stored in A:JMCdvlpythonprogWPy64-3820python-3.8.2.amd64Libsite-packagesnikolapluginsshortcodeemojidata
Activity.json
Flags.json
Food.json
LICENSE
Nature.json
Objects.json
People.json
Symbols.json
Travel.json
-
-
media Display media embedded from a URL, for example, this will embed a youtube video:
{{% media url=https://www.youtube.com/watch?v=8AF-Sm8d8yk %}}
In order to use the media directive, you must install the "micawber" Python package.
-
thumbnail Display image thumbnails, with optional captions. Examples:
{{% thumbnail "/images/foo.png" %}}{{% /thumbnail %}} {{% thumbnail "/images/foo.png" alt="Foo Image" align="center" %}}{{% /thumbnail %}} {{% thumbnail "/images/foo.png" imgclass="image-grayscale" figclass="figure-shadow" %}}<p>Image caption</p>{{% /thumbnail %}} {{% thumbnail "/images/foo.png" alt="Foo Image" title="Insert title-text joke here" align="right" %}}<p class="caption">Foo Image (right-aligned) caption</p>{{% /thumbnail %}}
The following keyword arguments are supported:
alt (alt text for image)
align (image alignment, left/center/right)
linktitle (title text for the link, shown by e.g. baguetteBox)
title (title text for image)
imgclass (class for image)
figclass (class for figure, used only if you provide a caption)
1.5 reStructuredText Extensions
The following sets the sections numbering and creates a table of contents floating on the right (and sections have a backling to the toc entry)
.. sectnum:: .. class:: alert alert-primary float-md-right .. contents:: Table of Contents :backlinks: entry
Specific Admonitions
Directive Types: "attention", "caution", "danger", "error", "hint", "important", "note", "tip", "warning", "admonition"
Warning
This a warning directive with .. warning::
Note
note with .. note::
Keys are converted to lowercase automatically.
.. Note to editors:
the paragraph below uses U+200B, zero-width space. Don’t break it.
admonition with .. admonition::
= Shortcodes and reStructuredText
In reStructuredText shortcodes may fail because docutils turns URL into links and everything breaks. For some shortcodes there are alternative docutils directives (example, you can use the media directive instead of the media shortcode.
Also, you can use the shortcode role:
:sc:`{{% shortcode here %}}`
That role passes text unaltered, so shortcodes behave correctly.
.. code-block:: python
TWITTER_CARD = { 'use_twitter_cards': True, # enable Twitter Cards 'card': 'summary', # Card type, you can also use 'summary_large_image', # see https://dev.twitter.com/cards/types 'site': '@website', # twitter nick for the website 'creator': '@username', # Username for the content creator / author. }
1.6 reStructuredText Extensions Includes
Include another RST file
.. include:: filename_full_path_before_interpretation
1.7 reStructuredText Extensions Media
In order to use the media directive, you must install the "micawber" Python package.
This directive lets you embed media from a variety of sites automatically by just passing the URL of the page. For example here are two random videos:
Bigflo et Oli: dommage
.. media:: https://www.youtube.com/watch?v=8AF-Sm8d8yk
.. media:: https://vimeo.com/233190141
It supports Instagram, Flickr, Github gists, Funny or Die, and dozens more, thanks to Micawber
1.8 reStructuredText Extensions YouTube
To link to a YouTube video, you need the id of the video. For example, if the URL of the video is http://www.youtube.com/watch?v=8N_tupPBtWQ what you need is 8N_tupPBtWQ
Once you have that, all you need to do is:
Bigflo et Oli: dommage
.. youtube:: 8AF-Sm8d8yk
Supported options: height
, width
, align
(one of left
,
center
, right
) — all are optional. Example:
.. youtube:: 8AF-Sm8d8yk :align: center
1.9 reStructuredText Extensions Vimeo
To link to a Vimeo video, you need the id of the video. For example, if the URL of the video is http://www.vimeo.com/20241459 then the id is 20241459
Once you have that, all you need to do is:
Bigflo et Oli: dommage
.. vimeo:: 233190141
If you have internet connectivity when generating your site, the height and width of the embedded player will be set to the native height and width of the video. You can override this if you wish:
.. vimeo:: 233190141 :height: 240 :width: 320
Supported options: height
, width
, align
(one of left
,
center
, right
) — all are optional.
1.10 reStructuredText Extensions Code
The code
directive has been included in docutils since version 0.9 and now
replaces Nikola's code-block
directive. To ease the transition, two aliases
for code
directive are provided: code-block
and sourcecode
:
.. code-block:: python :number-lines: print("Our virtues and our failings are inseparable")
1.11 reStructuredText Extensions Thumbnails
To include an image placed in the images
folder (or other folders defined in IMAGE_FOLDERS
), use the
thumbnail
directive, like this:
.. thumbnail:: /images/tesla.jpg :alt: Nikola Tesla
The small thumbnail will be placed in the page, and it will be linked to the bigger
version of the image when clicked, using
baguetteBox by default. All options supported by
the reST image
directive are supported (except target
). Providing alt
is recommended,
as this is the image caption. If a body element is provided, the thumbnail will
mimic the behavior of the figure
directive instead:
.. thumbnail:: /images/tesla.jpg :alt: Nikola Tesla Nikola Tesla, the man that invented the 20th century.
If you want to include a thumbnail in a non-reST post, you need to produce at least this basic HTML:
<a class="reference" href="images/tesla.jpg" alt="Nikola Tesla"><img src="images/tesla.thumbnail.jpg"></a>
1.12 reStructuredText Extensions Role doc
In Nikola, this role works only with pages but not with posts
:doc:`my text <my-slug#m-anchor>`
:doc:`creating a theme <creating-a-theme#starting-from-somewhere>`
* :doc:`Read the manual <handbook>` * `Visit the Nikola website to learn more <https://getnikola.com>`__ * `See a demo photo gallery <link://gallery/demo>`__ * :doc:`See a demo listing <listings-demo>` * :doc:`listings-demo` showing the title * :doc:`See a demo of a longer text <dr-nikolas-vendetta>`
Rendered
1.13 Custom Themes
Bootswatch: Free themes for Bootstrap https://bootswatch.com/
-
20200419 JMC To install bootstrap4-minty
Bootswatch: Minty - bootswatch.com https://bootswatch.com/minty/ (20200420_081536)
nikola subtheme -n custom_theme_name -s minty -p bootstrap4
2 Nikola path
for the links like
link://kind/name
3 reStructuredText quickref
3.1 Field Lists
Plain text
:Authors: Tony J. (Tibs) Ibbs, David Goodger (and sundry other good-natured folks) :Version: 1.0 of 2001/08/08 :Dedication: To my father.
-
Typical result
- Authors
-
Tony J. (Tibs) Ibbs, David Goodger
(and sundry other good-natured folks)
- Version
-
1.0 of 2001/08/08
- Dedication
-
To my father.
3.2 Literal Blocks
Plain text
Literal blocks end when text returns to the preceding paragraph's indentation. This means that something like this is possible:: We start here and continue here and end here.
-
Typical result
Literal blocks end when text returns to the preceding paragraph's indentation. This means that something like this is possible:
We start here and continue here and end here.
3.3 Explicit Markup: Footnotes
Plain text
Footnote references, like [5]_. Note that footnotes may get rearranged, e.g., to the bottom of the "page". .. [5] A numerical footnote. Note there's no colon after the ``]``. Autonumbered footnotes are possible, like using [#]_ and [#]_. .. [#] This is the first one. .. [#] This is the second one.
3.4 Explicit Markup: External Hyperlink Targets
Plain text
External hyperlinks, like Python_. .. _Python: http://www.python.org/ reStructuredText also provides for embedded URIs (details), a convenience at the expense of readability. A hyperlink reference may directly embed a target URI inline, within angle brackets. External hyperlinks with embed target URI, like `Python <http://www.python.org/>`_.
5 reStructuredText Directives - docutils.sourceforge.io
5.1 Directives for Substitution Definitions
5.1.1 Replacement Text
- Directive Type
-
"replace"
- Doctree Element
-
Text & inline elements
- Directive Arguments
-
None.
- Directive Options
-
None.
- Directive Content
-
A single paragraph; may contain inline markup.
The "replace" directive is used to indicate replacement text for a substitution reference. It may be used within substitution definitions only. For example, this directive can be used to expand abbreviations:
Yes, |reST| is a long word, so I can't blame anyone for wanting to abbreviate it. .. |reST| replace:: reStructuredText
Rendered
Yes, reStructuredText is a long word, so I can't blame anyone for wanting to abbreviate it.
As reStructuredText doesn't support nested inline markup, the only way to create a reference with styled text is to use substitutions with the "replace" directive:
I recommend you try |Python|_. .. |Python| replace:: Python, *the* best language around .. _Python: http://www.python.org/
Rendered
I recommend you try Python, the best language around.