Jekyll One

Fulltext Search

J1 Template adds a few extra features on top of the Asciidoc markup language. These extras are called extensions. They give you new shortcuts and macros that plain Asciidoc does not have on its own. Adding extensions like this is a feature you will not find in most other Jekyll themes.

The full list of extensions that ship with J1 is shown below.

Most of these extensions are based on examples from the Asciidoctor Extensions Lab. If you want to write your own extensions, the Extensions section of the Asciidoctor user manual is a good place to start.

The Asciidoc extensions were built mainly for Jekyll pages, but they also work in posts and collections.

5-10 Minutes to read.

Asciidoc Result Extension

J1 Template adds a small JavaScript helper called the View Result Extension. It puts a VIEW toggle button at the top right of any listing block (a code or example box).

If you place a result block [.result] right under a listing block, clicking the VIEW button shows or hides the result. Click it again to toggle.

The View Result Extension is useful for sections that explain code examples, because readers can see the example and the rendered result side by side.

This example places a VIEW button at the top right of the example box.

VIEW extension
* displayed always
displayed till clicked, but closed on second click (toggle)

Asciidoc Admonitions

An admonition is a colored, labeled box that calls attention to a piece of information — for example a tip, a warning, or an important note. The Asciidoc markup language provides five types of admonition, shown in the table below.

Table 1. Admonition labels
Name Description

NOTE

Additional details on the currently discussed topic that may help the reader to understand the following content better.

TIP

Provides facts that may help the reader to go further or points to additional options available that can be used.

IMPORTANT

Emphasis on what is currently being discussed and provide facts that should be remembered.

WARNING

instructs readers of potential danger, harm, or consequences for the wrong usage.

CAUTION

Advise the reader to act carefully and point to potential risks or trippings.

Each admonition type has its own default color. The colors used by J1 are shown in the example boxes further below.

To highlight a single paragraph, start it with the admonition label in uppercase, followed by a colon :.

Admonition paragraph syntax
NOTE: Followed by the paragraph text

For longer content that spans several paragraphs or includes other elements, set the label as an attribute on top of an example block. The label must be uppercase.

Admonition block syntax
[NOTE]
====
The block text (multiline)
====

To give an admonition an optional title, place a dot . directly followed by the title text on the line above the block.

Admonition block syntax + title
.title text
[NOTE]
====
The block text (multiline)
====
NOTE block

Icon background-color: indigo

TIP block

Icon background-color: green

IMPORTANT block

Icon background-color: orange

WARNING block

Icon background-color: yellow

CAUTION block

Icon background-color: red

Asciidoc Quote elements

A quote element is used to cite text from a book, a speech, a movie, or any other source. Quote elements use two attributes:

attribution

The attribution attribute is the name of who said or wrote the text.

information

The information attribute is optional. It gives the source — for example the book, speech, or play the text was taken from.

Quoted paragraph

For a short quote of one line or one paragraph, place the attribute list [quote, attribution, information] directly above the text.

Synopsis
[quote, attribution, information]
Quote or excerpt text

There is also a shorter way to turn a single paragraph into a quote:

  1. Wrap the paragraph in double quotes ".

  2. Add an optional attribution on the next line, prefixed with two dashes --.

Synopsis
"quoted paragraph"
-- attribution
Don’t do stupid things twice. The selection is too big for that.
— Jean-Paul Sartre

Quote block

If your quote is more than one paragraph long, place the text between two delimiter lines made of four underscores __.

Synopsis
[quote, attribution]
____
paragraph text (multiline)
____

Example of a quoted block.

Dennis: Oh, what a giveaway! Did you hear that? Did you hear that, eh?
That’s what I’m on about! Did you see him repressing me?

You saw him, Didn’t you?

— Monty Python and the Holy Grail

Lightboxes

A lightbox is a popup that shows an image in full size when the user clicks on its thumbnail. To make using lightboxes easier, J1 Template provides the lightbox:: block macro. This macro embeds one or more images and turns the J1 default lightbox on automatically.

You can set the image width, an optional caption, and extra CSS styles for all images placed with the macro.

Lightbox block for single images
.Block title
lightbox::<block_id>[ <images_width>, <images_data_id>, <role="CSS styles"> ]
Lightbox block for image groups
.Block title
lightbox::<block_id>[ <images_width>, <images_data_id>, <group_name>, <role="CSS styles"> ]

The role parameter for extra CSS styles is optional for every lightbox:: macro and can be left out.

In a lightbox block, images are placed using a plain HTML <img> tag and only resized in width — no other scaling is applied. This works well when all images are roughly the same size. For images of different sizes, use a gallery instead. A gallery rearranges the images so they fit the available space neatly.

Standalone Images

For better readability, define the image data as Asciidoc attributes instead of writing it inline. The image data is a string of comma-separated pairs:

Paired attributes
"path/to/image-1, image-caption-1, ..."
Example of an data attribute for a lightbox block
:data-images: "pages/image-1.jpg, Description 1, "pages/image-2.jpg, Description 2"

Image paths are resolved against a base path set in the site configuration _config.yml. By default this is /assets/images. If you use a relative path like path/to/image, the base path is added in front of it automatically.

If you use an absolute path (starting with /), the base path is ignored. This is the standard Asciidoc behavior. In that case you must write the full path to the image yourself.

The group parameter for the lightbox:: macro is optional. If you do not set a group, the images are treated as standalone — that is, the user cannot slide between them.

Lightbox block for standalone images
lightbox::<block_id>[ 800, {<data-images-id>} ]
Lightbox block for standalone images
Lightbox block for standalone images

Grouped Images

If a lightbox:: block contains more than one image, you can group the images so that the user can slide from one image to the next. To turn this on, set the group option for the block.

Lightbox block for grouped images
lightbox::<block_id>[ 400, {<data-images-group_id>}, <group_name> ]
Lightbox block for grouped images
Lightbox block for grouped images Lightbox block for grouped images

Galleries

J1’s default gallery is built on JustifiedGallery, a jQuery plugin that arranges images into neat, evenly aligned rows. J1 also wires the gallery up to the lightbox so that clicking an image opens it in full size.

The photos you take are usually not all the same size. Some are landscape, some are portrait, and some are square. A simple grid does not handle that well. A gallery uses a masonry-grid layout instead — the images are placed like bricks in a wall so that the rows fit together without big gaps.

Gallery macro for images and videos
.Gallery title
gallery::<gallery_id>[role="<additional CSS styles>"]
Image Gallery
Video Gallery

Country flags

Country flags are often used for language pickers or to mark content that belongs to a specific country. A small flag icon is much easier to recognize than a country name written out.

J1 Template ships with full country-flag support for Asciidoc documents.

You can place a flag inline using the flag: macro:

flag:country[style, size, modifier]    (1) (2) (3) (4)
1 All country flags can be found on the preview page for country flags
2 The style attribute can be one of: rectangle or squared
3 The size attribute can be one of: xs, sm, md, lg, xl (responsive) and 1x to 10x (proportional)
4 The modifier can be used to add individual CSS classes e.g. for BS styles for margin setting and other
Click on button VIEW to see what it looks like
flag:de[rectangle, 2x, ml-3 mr-2 mb-2] Germany (rectangle) +
flag:de[squared, 2x, ml-3 mr-3 mb-2] Germany (square)

Germany (rectangle)
Germany (square)

The flags come from Flag Icons, a complete collection of country flags in SVG vector format. They scale to any size without losing quality.

Table 2. Example of responsive flag sizes
Size Style Markup Render

xs

rectangle

Germany
flag:de[rectangle, xs]

sm

rectangle

Germany
flag:de[rectangle, sm]

md

rectangle

Belgium
flag:be[rectangle, md]

lg

rectangle

Denmark
flag:dk[rectangle, lg]

xl

rectangle

Spain
flag:es[rectangle, xl]

Icon Fonts

An icon font is a special font where each letter is a small picture (an icon). J1 Template includes full icon support for Asciidoc documents and bundles three popular icon-font sets:

  • Material Design Icons (MDI)

  • FontAwesome Icons V5 (FA)

  • Iconify-Framework Icons (IF)

Material Design Icons

Use the mdi: macro to place a Material Design icon inline:

mdi:icon_name[icon_size, modifier]   (1) (2) (3)
1 All icon_name can be found on the preview page for MDI Icon Previewer
2 The icon_size attribute can be one of: xs, sm, lg and 1x to 10x
3 The modifier can be used to set the e.g the color (md-blue), an animation (fa-pulsed) or the orientation (fa-rotate-45)
Click the VIEW button to see what it looks like
mdi:home[2x, mdi-pulsed ml-3 mr-2 mb-2] Symbol icon (pulsed) +
mdi:font-awesome[2x, ml-3 mr-2 mb-2] Brand icon +
mdi:apple[2x, md-indigo ml-3 mr-2] Brand icon (colored)

Symbol icon (pulsed)
Brand icon
Brand icon (colored)

The icon_size and modifier parameters are optional. If you leave them out, the icon size defaults to 1x, the color defaults to black, and no modifiers are applied.

FontAwesome Icons V5

FontAwesome has two inline macros: use fas: for standard icons and fab: for brand icons.

fas:icon_name[icon_size, modifier]   (1) (2) (3)
1 All icon_name can be found on the preview page at FA Icons
2 The icon_size attribute can be one of: xs, sm, lg and 1x to 10x
3 The modifier can be used to set e.g the color (md-blue), an animation (fa-pulsed) or the orientation (fa-rotate-45) of an icon
Click the VIEW button to see what it looks like
fas:home[2x, fa-pulsed ml-2 mr-2 mb-2] Solid icon (pulsed) +
fab:font-awesome[2x, ml-3 mr-2 mb-2] Brand icon +
fab:apple[2x, md-indigo ml-3 mr-2] Brand icon (colored)

Solid icon (pulsed)
Brand icon
Brand icon (colored)

The icon_size and modifier parameters are optional. If you leave them out, the icon size defaults to 1x, the color defaults to black, and no modifiers are applied.

Iconify-Framework Icons

Use the iconify: macro to place an Iconify icon inline:

iconify:icon_name[icon_size, modifier]   (1) (2) (3)
1 All icon_name can be found on the preview page at Iconify Icons
2 The icon_size attribute can be one of: xs, sm, lg and 1x to 10x
3 The modifier can be used to set e.g the color (md-blue) or additional positioning classes for margins and padding

Click the VIEW button to see what it looks like.

Brand Icon Open Source
iconify:logos:opensource[2x, mr-3 mb-3 ml-4] Brand Icon Open Source

Brand Icon Open Source

Brand Icon Netlify
iconify:logos:netlify[2x, mr-3 mb-3 ml-4] Brand Icon Netlify

Brand Icon Netlify

You can browse the complete Iconify icon set on the Iconify-Framework Icons page.

The icon_size and modifier parameters are optional. If you leave them out, the icon size defaults to 1x, the color defaults to black, and no modifiers are applied.

Note that not every icon set in Iconify supports color modifiers — if you set a color on a set that does not support it, the color will have no effect.

Blind Text

Blind text is fake placeholder text used to fill a page during design — for example, the well-known "Lorem ipsum" paragraphs. J1 provides the lorem: inline macro to generate blind text right inside your Asciidoc document. The macro is adapted from a helper in Middleman, a small static-site generator written in Ruby.

When you start a longer document, you usually do not have all the content yet. Filling the empty parts with blind text helps you see how the finished page will look while you are still writing.

The lorem: macro can produce many kinds of placeholders. Each kind is selected by a name. The basic syntax is:

lorem:macro[]
lorem:macro[size]
Example of a lorem sentences macro
lorem:sentences[5]

Vero quibusdam sint ea similique quasi nihil culpa sed aut debitis provident deleniti quia. Deleniti delectus cupiditate reprehenderit. Et non assumenda atque mollitia minima non voluptas nihil repellendus doloribus est sequi. Aliquam repudiandae deserunt aliquid repellendus. Ullam soluta placeat vel et iste quasi ut qui magnam.

Lorem Types

The table below lists every lorem: macro type you can use.

Table 3. Macros available
Macro Type Example

word[]

text

rem

words[5]

text

ullam aliquid occaecati quisquam dolor

sentence[]

text

Non sit quibusdam placeat deleniti laboriosam quo eum nam sint.

sentences[5]

text

Et provident excepturi hic ut quos nam eaque. Eveniet quod ut enim nisi impedit est. Occaecati laboriosam qui ex alias nostrum itaque eos fuga. Quaerat animi ea est nihil illo consequatur rerum. Odit quia tempore odio odit quia laborum.

date[]

date

Sat Jun 12, 1976

date[strftime] e.g. date[%Y-%m-%d]

date

2005-08-08

name[]

text

Makenzie Glover

first_name[]

text

Alexandra

last_name[]

text

Willis

email[]

email

trisha_byrne@gmail.com

Github Gist

Code snippets may helpful to support your readers for existing code examples. An excellent place for code snippets is at Github. To embed an existing gist into your documents, the Asciidoc Extention Gist block provides the block macro gist:: to do so.

The following Gist snippet is taken from this example:

.Gist title
gist::git_address[]
Example of a gist block
.Guard setup to live preview AsciiDoc output
gist::mojavelinux/5546622[]
Guard setup to live preview AsciiDoc output

What next

Bootstrap gives you a complete set of styles for responsive layouts, including tables. But standard Bootstrap tables can still be hard to read on small screens.

J1 Template builds on top of Bootstrap and adds extra CSS styles for responsive tables. The result is a table layout that stays readable on phones and tablets without losing portability.

See what Responsive Tables can do.