### Initialize a Hugo Module Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/README.md Initializes a new Hugo module for your site, creating the necessary `go.mod` file. Requires Go programming language to be installed. ```shell hugo mod init YOUR_OWN_GIT_REPOSITORY ``` -------------------------------- ### Example Markdown Admonition Block Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/README.md Demonstrates the portable Markdown style for creating a warning admonition block, compatible with platforms like GitHub, Obsidian, and Typora. ```md > [!WARNING] > Warning: This operation will delete all data. ``` -------------------------------- ### Basic Admonition Usage in Markdown Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/README.md Demonstrates the fundamental syntax for creating an admonition block in Markdown using the `NOTIFY` callout type. This shows a system notification example. ```markdown > [!NOTIFY] > System notification: Your password will expire in 30 days. ``` -------------------------------- ### Basic Hello World Function in Python Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/docs/content/demo.md A simple Python function that prints 'Hello, World!' to the console. This serves as a basic example of function definition and output in Python. ```python def hello_world(): print("Hello, World!") ``` -------------------------------- ### Import Hugo-admonitions Module in Hugo Configuration Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/README.md Configures a Hugo site to import the `hugo-admonitions` module, adding it to your site's dependencies. Examples are provided for both `hugo.yaml` and `hugo.toml` formats. ```yaml module: imports: - path: github.com/KKKZOZ/hugo-admonitions - path: my-theme ``` ```toml [module] [[module.imports]] path = "github.com/KKKZOZ/hugo-admonitions" [[module.imports]] path = "my-theme" ``` -------------------------------- ### Set Hugo-admonitions as Theme in Hugo Configuration Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/README.md Configures a Hugo site to use `hugo-admonitions` as a theme, placing it first in the theme list to ensure its styles and layouts are prioritized. Examples are provided for both `hugo.yaml` and `hugo.toml` formats. ```yaml theme: ["hugo-admonitions", "my-theme"] ``` ```toml theme = ["hugo-admonitions", "my-theme"] ``` -------------------------------- ### Customizing Admonition Title in Markdown (IDEA) Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/README.md Illustrates how to provide a custom title for an admonition block. This example uses the `IDEA` callout type with 'Summary' as the custom title. ```markdown > [!IDEA] Summary > This is a summary using the `IDEA` callout! ``` -------------------------------- ### Customizing Admonition Title in Markdown (MEMO) Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/README.md Shows another example of customizing the title of an admonition block. This uses the `MEMO` callout type with 'Summary' as the custom title. ```markdown > [!MEMO] Summary > This is a summary using the `MEMO` callout! ``` -------------------------------- ### Override Specific Hugo Admonition Type Colors Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/README.md SCSS map example for customizing colors of individual admonition types (e.g., note, tip, warning, danger) by defining `$admonition-colors-overrides` in your user settings file. ```scss // Example: assets/sass/vendors/_admonitions-user-settings.scss // --- Admonition Colors --- $admonition-colors-overrides: ( note: #007bff, // Make 'note' admonitions blue tip: #28a745, // Make 'tip' admonitions green warning: #ffc107, // Make 'warning' admonitions yellow danger: #dc3545, ); ``` -------------------------------- ### Create Hugo Project Directories and SCSS File Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/README.md Demonstrates shell commands to create the necessary directory structure (`assets/sass/vendors`) and an empty `_admonitions.scss` file within a Hugo project, preparing for advanced SCSS overrides. ```shell mkdir -p assets/sass/vendors touch assets/sass/vendors/_admonitions.scss ``` -------------------------------- ### Clone Hugo-admonitions as a Theme via Git Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/README.md Clones the `hugo-admonitions` repository into your Hugo site's `themes` directory using Git. The `--depth=1` option performs a shallow clone for faster download. ```bash git clone git@github.com:KKKZOZ/hugo-admonitions.git themes/hugo-admonitions --depth=1 ``` -------------------------------- ### API Usage Details for Users Endpoint Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/docs/content/demo.md This section outlines the key details for interacting with the `/api/v1/users` endpoint, including its purpose, required authentication method, and applicable rate limits. ```APIDOC Endpoint: /api/v1/users is used to fetch the user list. Authentication: A valid Bearer token must be provided in the request header. Rate Limiting: 100 requests are allowed per minute. ``` -------------------------------- ### Create Hugo Admonitions User Settings File Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/README.md Commands to create the necessary directory structure and an empty SASS file (`_admonitions-user-settings.scss`) in your Hugo project's assets folder for custom admonition styles. ```shell mkdir -p assets/sass/vendors touch assets/sass/vendors/_admonitions-user-settings.scss ``` -------------------------------- ### Hugo Project Directory Structure for SCSS Override Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/README.md Illustrates the expected directory structure within a Hugo project after creating the `_admonitions.scss` file, showing where the overridden main SCSS file should reside. ```text your-hugo-project/ └── assets/ └── sass/ └── vendors/ └── _admonitions.scss <-- Your overridden main SCSS file ``` -------------------------------- ### Fetch Data using Axios in JavaScript Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/docs/content/demo.md This JavaScript function demonstrates how to fetch data from an API endpoint `/api/data` using the Axios library. It returns a Promise that resolves with the API response. ```javascript function fetchData() { return axios.get('/api/data'); } ``` -------------------------------- ### Render Foldable Admonition HTML Structure Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/layouts/_default/_markup/render-blockquote-alert.html Generates the HTML structure for a foldable admonition using the `
` and `` tags. The `open` attribute is conditionally added based on `.AlertSign`. It embeds the icon, title, and the main text content, allowing users to expand or collapse the admonition. ```Go Template
{{- partialCached $partial . }} {{ $title }} {{- with .Text }}
{{ . }}
{{- end }}
``` -------------------------------- ### Transpile Admonitions Sass to CSS in Hugo Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/layouts/_default/_markup/render-blockquote-alert.html This snippet transpiles the `_admonitions.scss` file into CSS and ensures it's loaded only once per page to avoid redundant processing. It configures Sass options like source maps and output style (compressed for production, expanded for development) based on the Hugo environment. ```Go Template {{- if not (.Page.Store.Get "admonition-style-loaded-flag") }} {{- with resources.Get "sass/vendors/_admonitions.scss" }} {{- $opts := dict "enableSourceMap" (not hugo.IsProduction) "outputStyle" (cond hugo.IsProduction "compressed" "expanded") "targetPath" "css/vendors/admonitions.css" }} {{- with . | toCSS $opts }} {{- if hugo.IsProduction }} {{- with . | fingerprint }} {{- end }} {{- else }} {{- end }} {{- end }} {{- end }} {{- .Page.Store.Set "admonition-style-loaded-flag" true }} {{- end }} ``` -------------------------------- ### Update Hugo Modules Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/README.md Updates all Hugo modules to their latest versions, ensuring that all dependencies are current after configuration changes. ```shell hugo mod get -u ``` -------------------------------- ### Nested Admonitions in Markdown Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/README.md Shows how to create nested admonition blocks, allowing for hierarchical organization of content within admonitions. This demonstrates multiple levels of nesting. ```markdown > [!QUESTION] Can admonitions be nested? > > [!TODO] Yes!, they can. > > > [!EXAMPLE] You can even use multiple layers of nesting. ``` -------------------------------- ### Foldable Admonitions with Extended Syntax in Markdown Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/README.md Illustrates the use of Hugo's extended blockquote syntax to create foldable (collapsible) admonitions. The `+` and `-` suffixes control the initial collapsed or expanded state. ```markdown > [!TIP]- Click here to view the tips > [!TIP]+ Click here to view the tips ``` -------------------------------- ### Hugo Admonitions User Settings File Structure Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/README.md Illustrates the expected directory structure within your Hugo project after creating the custom SASS settings file for admonition variable overrides. ```text your-hugo-project/ └── assets/ └── sass/ └── vendors/ └── _admonitions-user-settings.scss <-- Your custom settings file ``` -------------------------------- ### Determine Admonition Type, Title, and Icon Path Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/layouts/_default/_markup/render-blockquote-alert.html This section determines the final admonition type, title, and the path to its corresponding icon partial. It uses the `$icons` map to validate the alert type, falls back to 'note' if unrecognized, and generates a localized or default title. It also includes an error check to ensure the icon partial exists. ```Go Template {{- $type := cond (index $icons .AlertType) .AlertType "note" }} {{- $title := or .AlertTitle (T (printf "admonitions.%s" $type)) (title $type) }} {{- $iconFile := index $icons $type }} {{- $partial := printf "admonitions/icons/%s" $iconFile }} {{- if not (templates.Exists (printf "partials/%s" $partial)) }} {{- errorf "The blockquote render hook was unable to find the icon partial at layouts/partials/%s for admonition type '%s'." $partial $type }} {{- end }} ``` -------------------------------- ### Available Admonition Callout Types Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/README.md Lists the various predefined callout types supported by the Hugo Admonitions module, categorized by their primary function (Alerts & Emphasis, Information & Elaboration, Guidance & Interaction). These types determine the icon and styling of the admonition. ```APIDOC Alerts & Emphasis: [!DANGER] [!ERROR] [!WARNING] [!CAUTION] [!IMPORTANT] [!SUCCESS] Information & Elaboration: [!INFO] [!NOTE] [!ABSTRACT] [!CONCLUSION] [!EXAMPLE] [!QUOTE] [!CODE] [!EXPERIMENT] [!MEMO] Guidance & Interaction: [!TIP] [!TASK] [!GOAL] [!IDEA] [!QUESTION] [!NOTIFY] ``` -------------------------------- ### Override Hugo Admonitions Theme Colors Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/README.md SCSS variables for customizing the background, text, code, and blockquote border colors for Hugo admonitions in both light and dark modes, along with header background opacity. ```scss // --- Theme Colors --- // Define the colors used for admonition elements in both light and dark modes. // Light Mode Colors $admonition-light-bg: #ffffff; // Content background $admonition-light-text: #000000; // Content text $admonition-light-code-bg: #f5f5f5; // Inline code & code block background $admonition-light-code-text: #24292e; // Inline code & code block text $admonition-light-blockquote-border: #e0e0e0; // Blockquote left border // Dark Mode Colors $admonition-dark-bg: #1d1e20; // Content background $admonition-dark-text: #e6e6e6; // Content text $admonition-dark-code-bg: #313244; // Inline code & code block background $admonition-dark-code-text: #cdd6f4; // Inline code & code block text $admonition-dark-blockquote-border: #45475a; // Blockquote left border // --- Header Background Opacity --- // Controls the opacity of the background color tint applied to the whole admonition block. // Value should be between 0 (transparent) and 1 (opaque). $admonition-light-header-bg-opacity: 0.1; // Opacity for light mode background tint $admonition-dark-header-bg-opacity: 0.1; // Opacity for dark mode background tint ``` -------------------------------- ### Header-Only Admonitions in Markdown Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/README.md Demonstrates how to create admonitions that only display the header or title, without additional body content. This is useful for concise alerts or messages. ```markdown > [!TIP] You can choose to only to show the header! > [!NOTIFY] System notification: Your password will expire in 30 days > [!SUCCESS] Congratulations! Your code has been successfully deployed to production > [!WARNING] Warning: This operation will delete all data. ``` -------------------------------- ### Map Admonition Alert Types to SVG Icons in Hugo Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/layouts/_default/_markup/render-blockquote-alert.html Defines a dictionary (`$icons`) that maps various admonition alert types (e.g., 'abstract', 'caution', 'info') to their corresponding SVG icon filenames. This mapping is crucial for dynamically selecting and rendering the correct visual icon for each admonition type. ```Go Template {{- $icons := dict "abstract" "file-lines-solid.svg" "caution" "triangle-exclamation-solid.svg" "code" "code-solid.svg" "conclusion" "file-circle-check-solid.svg" "danger" "triangle-exclamation-solid.svg" "error" "circle-xmark-solid.svg" "example" "person-chalkboard-solid.svg" "experiment" "flask-solid.svg" "goal" "bullseye-solid.svg" "idea" "lightbulb-solid.svg" "important" "circle-exclamation-solid.svg" "info" "circle-info-solid.svg" "memo" "file-lines-solid.svg" "note" "file-pen-solid.svg" "notify" "bell-solid.svg" "question" "circle-question-solid.svg" "quote" "quote-right-solid.svg" "success" "circle-check-solid.svg" "task" "list-check-solid.svg" "tip" "lightbulb-solid.svg" "warning" "triangle-exclamation-solid.svg" }} ``` -------------------------------- ### Render Standard Blockquote HTML Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/layouts/_default/_markup/render-blockquote-alert.html This snippet acts as a fallback, rendering the content as a standard HTML `
` element if the input type is not recognized as an 'alert'. This ensures that regular blockquote content is displayed correctly when it's not intended to be an admonition. ```Go Template
{{ .Text }}
``` -------------------------------- ### Render Non-Foldable Admonition HTML Structure Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/layouts/_default/_markup/render-blockquote-alert.html Generates the HTML structure for a non-foldable admonition using standard `
` and `` elements. This structure displays the icon, title, and the main text content directly, without any collapse or expand functionality, suitable for always-visible alerts. ```Go Template
{{- partialCached $partial . }} {{ $title }} {{- with .Text }}
{{ . }}
{{- end }}
``` -------------------------------- ### Enforce Minimum Hugo Version for Admonitions Source: https://github.com/kkkzoz/hugo-admonitions/blob/main/layouts/_default/_markup/render-blockquote-alert.html Checks if the current Hugo version meets the minimum requirement (v0.140.0) for the admonitions feature. If the version is older, it throws an error during site generation, preventing the use of incompatible Hugo versions with the admonitions module. ```Go Template {{- $minHugoVersion := "0.140.0" }} {{- if lt hugo.Version $minHugoVersion }} {{- errorf "Hugo-admonitions requires Hugo v%s or later. Please upgrade Hugo to v%s or higher." $minHugoVersion $minHugoVersion }} {{- end -}} ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.