s |
focus search bar ( enter to select, ▲ / ▼ to change selection) |
g e |
go to examples |
g g |
go to guides |
g l |
go to layout_api |
h |
toggle this help ( esc also exits) |
Each section on this page illustrates liquid syntax that can be used to invoke macros provided by the programming pages theme.
embeds a collapsed example that the user can expand if interested.
parameter | description |
---|---|
file |
path to example file for embedding (must be rooted in _includes ) |
syntax |
(optional) hint for syntax hilighter; defaults to file extension |
id_only |
(optional) when 'true' (string value), macro only evaluates to id of example label, e.g. to use in an href; defaults to empty string and normal behavior of embedding code example |
{% include collapsible_example.liquid file='snippets/hello_world.cpp' %}
/*
Hello World
To compile and run this program:
1. Save the code in a file with name "hello_world.cpp"
2. Execute the following command in a terminal window:
$ g++ -o /tmp/hello_world hello_world.cpp
..which invokes the Gnu C++ compiler, asking it to output
an executable file into /tmp with name "hello_world".
3. Execute the following command in a terminal window:
$ /tmp/hello_world
..which will then run the program, causing the message
"Hello World!" to be written to the terminal.
*/
#include <iostream>
int main()
{
std::cout << "Hello World!" << std::endl;
return 0;
}
inserts SVG code for an icon. SVG icons are defined in _data/icons/theme.yml by the theme. See the markdown sampler for a list of icon ids.
parameter | description |
---|---|
id |
icon name from yaml data file |
class |
(optional) css class string to apply to the embedded svg element in addition to icon |
{% include icon.liquid id='star' %}
generates a javascript function that logs information to the console.
the function is submitted to jQuery’s document ready function ($()
).
parameter | description |
---|---|
lvl |
<log|info|warn|error> (optional, defaults to log ; message level) |
msg |
<string> (optional; message to print to console at specific level) |
table |
[..] (optional; object to be logged as a table) |
values |
[..] (optional; array of values to be logged individually at message level) |
keys |
[..] (optional; array of labels to be combined with values and logged as a table) |
{% include log.liquid msg='[programming-pages] hello, console' %}
{% include log.liquid msg='[programming-pages] warning, console' lvl='warn' %}
{% assign log_k = '' | split: '' %}
{% assign log_v = '' | split: '' %}
{% assign log_k = log_k | push: 'key 1' %}{% assign log_v = log_v | push: 'value one' %}
{% assign log_k = log_k | push: 'key 2' %}{% assign log_v = log_v | push: 'value two' %}
{% assign log_k = log_k | push: 'key 3' %}{% assign log_v = log_v | push: 'value three' %}
{% include log.liquid msg='[programming-pages] key/value pairs to table' keys=log_k values=log_v %}
(open the browser's javascript console to see the examples)
(open the browser’s javascript console to see the examples)
generates an html list of child pages, respecting their
page.order
value.
only first-level children are listed, grandchildren and beyond are ignored. order:0
is first,-1
is last, undefined orders go in the middle alphabetically
parameter | description |
---|---|
docs |
reference to list of Jekyll collection docs |
page |
(optional) reference to scoping page, restricting the list to children of the page |
{% include ordered_child_list.liquid docs=site.examples %}
abbreviates intermediary package names to their first letter:
foo.bar.bat.Baz
→foo.b.b.Baz
parameter | description |
---|---|
package |
fully qualified package name |
threshold |
(optional) number of components to leave unabbreviated. defaults to 2 |
{% assign packages = "foo.bar.bat, foo.bar.bat.Baz, foo.Qix" | split: ", " %}
{% for pkg in packages %}
- {% include package_shortener.liquid package=pkg %}
{% endfor %}
foo.b.bat
foo.b.b.Baz
foo.Qix
extracts the first component of a page url:
/examples/includes/
→/examples
parameter | description |
---|---|
page |
reference to a Jekyll page object to extract the url root from |
{% include page_root.liquid page=page %}
/examples
creates the individual links in the sidebar.
links are indented when parented, unless their page layout has been excluded withno_indent
parameter | description |
---|---|
doc_list |
reference to list of Jekyll collection docs to generate indices for |
collection_label |
name of indices tab, to ensure links keep proper tab open |
page_title |
title of the current page, to render matching indices as ‘active’ |
no_indent |
pipe (| ) delimited list of layouts that should not be indented |
<div class="ui link list">
{% assign collection = site.collections | where:"title","Examples" | first %}
{% include render_indices.liquid doc_list=collection.docs collection_label=collection.label page_title=page.title %}
</div>
programming pages
2020 pixeldroid
https://github.com/pixeldroid/programming-pages |
programming pages theme v0.5.22 (https://github.com/pixeldroid/programming-pages) |
s |
focus search bar ( enter to select, ▲ / ▼ to change selection) |
g e |
go to examples |
g g |
go to guides |
g l |
go to layout_api |
h |
toggle this help ( esc also exits) |