Blocks

Choose the elements that make up a Jikji document.

Download Markdown
On this page

A block is one element of the document. Add block (+ in the toolbar) lists them by category; the table also shows the HTML each block is, which matters when you write documents by hand (Syntax reference).

3.1 The catalogue#

Category Block Element Notes
Layout Section section A container
Layout Div div (also article, aside, header, footer, main, nav, figure…) A container; an empty div too
Layout Template Part <div j:part="…"> Template documents only (3.8)
Basic Heading h1–h6 Level in the panel
Basic Text p (also span, figcaption, time, summary) Plain text
Basic Rich Text div with inline markup Its inner HTML is edited as a string (3.9)
Basic Blockquote blockquote
Basic List / List Item ul/ol and li
Basic Link a A text link; becomes a container when blocks are placed inside it
Basic Button a with href="#" A new Button is a styled link, not a <button>: it submits no form and has no native disabled. An existing <button> element in a document is read as a Button block too
Media Image img Media library (3.2)
Media Video video Media library; Autoplay, Muted, Controls
Media Icon <i class="ri-…"> / <i class="bi bi-…"> Enabled icon sets only (3.3)
Media SVG svg Pasted inline SVG, sanitized (3.4)
Widgets Shortcode <div j:shortcode="…"> (3.5)
Widgets Code <div j:code> HTML/PHP output as written (3.6)
Widgets WordPress blocks <div wp:…> Any registered Gutenberg block, a block island (3.7)

Containers accept children; the others do not. Every element gets a server-issued ID (jk- + six characters) when it is added; the ID is what its styles hang on (Styles).

3.2 Image and Video#

Both insert at once and are filled from the Media Library button in the right panel (choose or replace the file). Image settings: Alt, Lazy load. Video settings: Autoplay, Muted, Controls. The src, alt and poster attributes can also be bound to data (Dynamic data 5.3) — for example a post's featured image.

3.3 Icon#

  1. Pick the icon set (only sets enabled under Appearance → Jikji → General are offered).
  2. Search the icon name (the name list is bundled; searching needs no network).
  3. Apply.

The block stores the icon set's own markup — Remixicon <i class="ri-{name}">, Bootstrap Icons <i class="bi bi-{name}"> — and the front end loads the set's stylesheet only on documents that use it. If a set is disabled later, existing icons keep their markup but are not shown until the set is enabled again; the panel offers only active sets.

3.4 SVG#

Paste or type inline <svg> markup (there is no upload path; WordPress blocks SVG uploads by default). The server sanitizes it with an allowlist of elements and attributes: <script>, <foreignObject>, on* handlers, javascript: and external href/url() references are removed; the editor applies the same rules immediately and the save reports what it dropped as warnings. CSS inside the SVG may only reference url(#id) within the same SVG. The root id belongs to the block: if the pasted SVG had another root ID, internal references to it (url(#…), href="#…", ID selectors in <style>) are rewritten to the block ID so the drawing still works. The compiler stores the SVG as text and never rewrites it (viewBox casing is kept).

3.5 Shortcode#

A shortcode string, stored as <div j:shortcode="[gallery ids=&quot;1,2&quot;]"></div>. The panel offers the tags registered on this site as completions. The canvas shows a server-rendered static preview (scripts and handlers stripped); submit buttons, validation and completion screens of a form plugin only work on the front end. On the page the element's content is do_shortcode() of the string.

Forms are a typical use: Jikji does not build forms; a form plugin's shortcode goes in a Shortcode block, the plugin's CSS and JS load with it (page documents render it inside the_content, templates before <head> — both work with most plugins), and styling is done in the theme CSS against the plugin's classes.

3.6 Code#

HTML, and PHP, written as the text of <div j:code>…</div>. On the page the whole element is replaced by the code as written — no escaping — so it is a server-code path and is only available to builders (jikji_compile). The canvas shows a placeholder, never executes it; check the result in Preview. It cannot have other j: attributes or child elements. Prefer the helpers and bindings for data; prefer the theme for JavaScript (Dynamic data 5.9).

3.7 WordPress blocks (block islands)#

One Gutenberg block — with everything inside it — is one Jikji node, a block island. Inside the island Gutenberg rules (block editor, serialization, rendering); outside, Jikji. Jikji elements are never placed inside an island.

  • Add: the WordPress category in Add block — search, block categories, Recent. Blocks that must live inside a parent (core/column, core/list-item…) are added inside the island's own editor. The block editor stack loads on first use.
  • Edit: with an island selected, the right panel offers Properties | Block. The Block tab shows the block card, a block canvas (an iframe with the theme's editor styles, inner blocks included), the inspector, Edit block (the same editor in a large modal) and Remove block. Properties for an island only shows a note and the Condition (j:if), since the element itself is not output.
  • Root rule: the island editor's top-level blocks are taken as they are — one block is the node, several (Enter split, pasting, duplicate, ungroup) make the first block this node and the rest new sibling islands right after it. Deleting the root block inside the editor leaves an empty paragraph island; an island node is removed only explicitly (Navigator, canvas, Remove block).
  • Canvas: islands show a server-rendered preview with the block's own CSS; inside a loop, the first item's post is the block's post. An island in an empty loop shows "no items"; a loop expression error shows the error; an unregistered block gets a warning border.
  • Storage: <div id="…" wp:core--latest-posts="{&quot;postsToShow&quot;:3}">…serialized block markup…</div> — the attribute name is the block name, the value its attributes JSON, the text the serialized block markup. See Syntax 8.6 for the exact rules (attributes-only versus markup form, attrsOnly).

Importing block content. A post written in the block editor can be converted into a Jikji document once (one-way; there is no sync back). When you open the builder on a post that has block content and no Jikji document yet, it offers Import the block content / Start empty; wp jikji content import <id> and POST /content/<id>/import do the same. Paragraphs, headings, lists, images, quotes, buttons and shortcodes become Jikji elements (as their rendered HTML, so default classes such as wp-block-paragraph stay and theme CSS still applies); blocks with bindings, layout classes, lightbox, core/html, synced patterns (core/block), dynamic and third-party blocks stay as islands; a container with any such block inside stays an island as a whole. Original id attributes are kept (duplicates or IDs that already own a style row get a new ID and the references are fixed, with a warning). Nothing from the original can become server code: j:/wp: attributes, comments and processing instructions are removed, <script>/<style>/<svg> containing <? go into a core/html island, and the result is compiled and counted before it is returned (jikji_import_unsafe otherwise). The result opens as an unsaved document with a summary; post_content is never changed.

3.8 Template Part#

Template documents only (Templates). <div j:part="header"></div> is replaced on the page by that template part — a block part renders as WordPress renders it, a Jikji-published part renders its compiled output. The panel lists the active theme's parts; a managed part links to its own builder, an unmanaged one links to the Site Editor. The element itself is not output, so it has no styles of its own; only a Condition can be added. A part never includes itself.

3.9 Rich Text and inline markup#

A div that contains only text, or any element that mixes text and inline elements (<p>a <b>b</b></p>), is a Rich Text block: its inner HTML is edited as one string. Bindings belong on block elements — a j:* attribute written inside Rich Text markup compiles and outputs, but the canvas shows no sample for it and the Data panel cannot edit it.

Chapters