Add Hextra shortcodes (Bootstrap 5 port)#172
Merged
fitzergerald merged 3 commits intomasterfrom Apr 1, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a set of Hextra-inspired Hugo shortcodes to the academy theme, rewritten to use Bootstrap 5 classes and supported by new utility partials, icons data, and theme SCSS/JS assets.
Changes:
- Introduces 17 new
hextra/*shortcodes (callouts, cards, tabs, steps, details, filetree, embeds, etc.). - Adds supporting utilities (
hextra/utils/*) and a largedata/hextra/icons.yamlicon set. - Adds shortcode-specific styling (
_hextra_shortcodes.scss) and new JS modules underassets/js/hextra/.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| layouts/shortcodes/hextra/term.html | New glossary-term tooltip shortcode backed by data/<lang>/termbase.yaml. |
| layouts/shortcodes/hextra/tabs.html | Bootstrap 5 tabs container + optional cross-page sync (inline script). |
| layouts/shortcodes/hextra/tab.html | Child tab shortcode that populates parent Store. |
| layouts/shortcodes/hextra/steps.html | Steps container (CSS-counter-based styling via SCSS). |
| layouts/shortcodes/hextra/pdf.html | PDF iframe embed using file-path resolver partial. |
| layouts/shortcodes/hextra/jupyter.html | Jupyter notebook renderer from local or remote .ipynb. |
| layouts/shortcodes/hextra/include.html | Includes another page’s rendered content via RenderShortcodes. |
| layouts/shortcodes/hextra/icon.html | Renders inline SVGs from data/hextra/icons.yaml. |
| layouts/shortcodes/hextra/filetree/container.html | Filetree wrapper + inline folder toggle script. |
| layouts/shortcodes/hextra/filetree/folder.html | Filetree folder row with open/closed state and icons. |
| layouts/shortcodes/hextra/filetree/file.html | Filetree file row with file icon + name. |
| layouts/shortcodes/hextra/details.html | <details>-based accordion/card with chevron styling. |
| layouts/shortcodes/hextra/cards.html | Cards grid container using Bootstrap row/cols utilities. |
| layouts/shortcodes/hextra/card.html | Linked card component with optional image/icon/badge + image processing. |
| layouts/shortcodes/hextra/callout.html | Bootstrap alert-based callout component with icon/emoji support. |
| layouts/shortcodes/hextra/badge.html | Inline badge shortcode with semantic-to-Bootstrap color mapping. |
| layouts/shortcodes/hextra/asciinema.html | Asciinema player container + file resolution + markers support. |
| layouts/partials/hextra/utils/icon.html | Utility partial to render raw SVG from site.Data.hextra.icons. |
| layouts/partials/hextra/utils/file-path.html | Utility to resolve relative/absolute/URL paths for embeds. |
| data/hextra/icons.yaml | Adds the SVG icon registry used by hextra/icon. |
| assets/scss/_styles_project.scss | Imports the new hextra shortcode SCSS. |
| assets/scss/_hextra_shortcodes.scss | New Bootstrap-compatible styling for the added shortcodes. |
| assets/js/hextra/tabs.js | JS module for tab sync (currently duplicates inline script). |
| assets/js/hextra/filetree.js | JS module for filetree toggling (currently inconsistent with templates). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Port 14 shortcodes from the Hextra Hugo theme, rewritten to use
Bootstrap 5 classes instead of Tailwind CSS, and namespaced under
hextra/ to avoid conflicts with existing Hugo, Docsy, and
academy-theme shortcodes.
Shortcodes added:
hextra/callout, hextra/cards, hextra/card, hextra/details,
hextra/steps, hextra/tabs, hextra/tab, hextra/badge, hextra/icon,
hextra/pdf, hextra/include, hextra/jupyter, hextra/asciinema,
hextra/term, hextra/filetree/container, hextra/filetree/folder,
hextra/filetree/file
Supporting files:
- layouts/partials/hextra/utils/{icon,file-path}.html
- data/hextra/icons.yaml (SVG icon definitions)
- assets/scss/_hextra_shortcodes.scss (custom styles)
- assets/js/hextra/{tabs,filetree}.js (standalone JS modules)
Signed-off-by: Alex Quinn <227241865+alexquincy@users.noreply.github.com>
…k rendering
- Switch steps and details shortcodes from {{% %}} to {{< >}} syntax
to prevent Goldmark from stripping raw HTML output of nested shortcodes
- Use .InnerDeindent | .Page.RenderString in steps.html to render
Markdown headings while preserving nested shortcode output
- Enable goldmark.renderer.unsafe in theme config so .Page.RenderString
does not strip raw HTML from nested shortcodes (cards, tabs, filetree, etc.)
Signed-off-by: Alex Quinn <227241865+alexquincy@users.noreply.github.com>
- tab.html: normalize selected param to boolean via eq comparison to
"true" so that selected="false" is no longer truthy
- term.html: guard data lookup with nested `with` blocks so missing
language key or termbase gracefully degrades instead of erroring
- filetree/folder.html: use fixed data-state="closed"/"open" on icon
spans so toggle script correctly shows/hides the right icon
- filetree/file.html: use plainify instead of markdownify to avoid
block-level HTML inside an inline span
- card.html: render <div> instead of <a> when no link is provided for
valid HTML/a11y; add rel="noopener noreferrer" on external links
- badge.html: add rel="noopener noreferrer" to badge links
- asciinema.html: remove unreachable errorf dead code; use jsonify for
marker serialization to prevent injection; add inline CDN script and
player initialization so asciinema-player actually loads
- jupyter.html: render markdown cells via .Page.RenderString instead of
raw safeHTML; gate HTML notebook outputs behind allowUnsafeHTML param
- icons.yaml: fix partial path in usage comment
- Remove unused assets/js/hextra/{filetree,tabs}.js that duplicated
inline scripts already emitted by shortcode templates
Signed-off-by: Alex Quinn <227241865+alexquincy@users.noreply.github.com>
0c4694b to
52e60cf
Compare
fitzergerald
approved these changes
Apr 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
hextra/(e.g.{{< hextra/callout >}},{{< hextra/tabs >}}) to avoid conflicts with existing Hugo built-in, Docsy, and academy-theme shortcodesShortcodes added
hextra/callout{{< hextra/callout type="info" >}}Text{{< /hextra/callout >}}hextra/cards+hextra/cardhextra/details{{% hextra/details title="Expand" %}}Content{{% /hextra/details %}}hextra/stepshextra/tabs+hextra/tabhextra/badgehextra/icondata/hextra/icons.yamlhextra/pdfhextra/includehextra/jupyterhextra/asciinemahextra/termdata/<lang>/termbase.yamlhextra/filetree/*Files added/modified
layouts/shortcodes/hextra/layouts/partials/hextra/utils/(icon renderer, file-path resolver)data/hextra/icons.yaml(SVG icon definitions)assets/scss/_hextra_shortcodes.scss(custom component styles)assets/js/hextra/(tab sync, filetree toggle)assets/scss/_styles_project.scss(added SCSS import)Design decisions
tabs/tabparent-child communication pattern from Hextra is maintained for content collection at build timeTest plan
hugo buildsucceeds with zero template errorshextra/calloutwith all 5 types (default, info, warning, error, important) and emoji varianthextra/tabswith multiple tab groups and verify Bootstrap JS switching workshextra/filetreefolder expand/collapse togglehextra/cardwith images, icons, and tagsalert,details,pageinfo, etc.) still work unchanged