Hinode logo
  • About 
  • Docs 
  • Components 
  • Guides 
  • Releases 
  •  
  •    Toggle theme
    •   Light
    •   Dark
    •   Auto
  •  
    •   Light
    •   Dark
    •   Auto
Docs
    • Introduction
    • Commands
    • Hosting and deployment
    • Upgrading
    • Contribute
    • Troubleshooting
    • Content management
    • Content organization
    • Typography
    • Links and cross-references
    • Images and figures
    • Tables
    • Icons
    • Layout
    • Colors
    • Color modes
    • Fonts
    • Languages
    • Navigation
    • Documentation
    • Analytics
    • Modules
    • Abbr
    • Accordion
    • Alert
    • Animation
    • Badge
    • Breadcrumb
    • Button
    • Button group
    • Card
    • Card group
    • Carousel
    • Collapse
    • Command prompt
    • Docs
    • Example
    • File
    • Icon
    • Image
    • Kbd
    • Link
    • Map
    • Mark
    • Navbar
    • Navs and tabs
    • Release
    • Spinner
    • Spinner
    • Sub
    • Sup
    • Timeline
    • Toast
    • Tooltip
    • Overview
    • Styles
    • Scripts
    • Icons
    • Module development
    • Server headers
    • Server-side redirection
    • Credits
    • License
    • Introduction
    • Commands
    • Hosting and deployment
    • Upgrading
    • Contribute
    • Troubleshooting
    • Content management
    • Content organization
    • Typography
    • Links and cross-references
    • Images and figures
    • Tables
    • Icons
    • Layout
    • Colors
    • Color modes
    • Fonts
    • Languages
    • Navigation
    • Documentation
    • Analytics
    • Modules
    • Abbr
    • Accordion
    • Alert
    • Animation
    • Badge
    • Breadcrumb
    • Button
    • Button group
    • Card
    • Card group
    • Carousel
    • Collapse
    • Command prompt
    • Docs
    • Example
    • File
    • Icon
    • Image
    • Kbd
    • Link
    • Map
    • Mark
    • Navbar
    • Navs and tabs
    • Release
    • Spinner
    • Spinner
    • Sub
    • Sup
    • Timeline
    • Toast
    • Tooltip
    • Overview
    • Styles
    • Scripts
    • Icons
    • Module development
    • Server headers
    • Server-side redirection
    • Credits
    • License

Example

Share via
Hinode
Link copied to clipboard

The example shortcode displays a code example and renders a preview of the same input.

On this page
 

  • Overview
  • Arguments
  • Examples
    • Hugo code example
    • Hidden markup
    • Hidden preview

Overview  

Added in v0.8.0  

The example shortcode displays a code example and renders a preview of the same input. The shortcode accepts the languages supported by Hugo’s highlight function  .

export MY_VAR=123
markdown
{{< command >}}
export MY_VAR=123
{{< /command >}}

Arguments  

The shortcode supports the following arguments:

ArgumentRequiredDescription
idNoOptional identifier of the element’s container.
langNoLanguage used to display the code. Use “hugo” to process Hugo (escaped) shortcodes, default value is “html”.
show_markupNoIf the markup should be output in the HTML, defaults to “true”.
show_previewNoIf the preview should be output in the HTML, defaults to “true”.
classNoOptional class attributes of the element’s container.

Examples  

Change the style and language of your code snippet with shortcode arguments.

Hugo code example  

Set the lang argument to hugo to render a Hugo code example. Be sure to escape the input with /* and */ delimiters to avoid rendering issues.

Preview  

export MY_VAR=123
markdown
{{< command >}}
export MY_VAR=123
{{< /command >}}

Input  

{{< example lang="hugo" >}}
    {{</* command */>}}
    export MY_VAR=123
    {{</* /command */>}}
{{< /example >}}

Hidden markup  

Set show_markup to false to hide the code input and to display the preview only.

Preview  

This is a lead paragraph. It stands out from regular paragraphs.

Input  

{{< example show_markup=false >}}
This is a lead paragraph. It stands out from regular paragraphs.
{.lead}
{{< /example >}}

Hidden preview  

Set show_preview to false to hide the output and to display the code input only.

Preview  

markdown
This is a lead paragraph. It stands out from regular paragraphs.
{.lead}

Input  

{{< example show_preview=false >}}
This is a lead paragraph. It stands out from regular paragraphs.
{.lead}
{{< /example >}}
Last updated: September 2, 2023 • Convert to markdown only (6581c88)
On this page
  • Overview
  • Arguments
  • Examples
    • Hugo code example
    • Hidden markup
    • Hidden preview
Example
Example
Hinode is a clean documentation and blog theme for your Hugo site based on Bootstrap 5.
Code licensed MIT, docs CC BY-NC 4.0
Currently v0.21.0-beta9
 
Links
Home 
About 
Docs 
Components 
Releases 
Guides
Getting started 
Developing modules 
Optimization 
Versioning 
Community
Issues  
Discussions  
Contribute 
Hinode
Code copied to clipboard