Skip to content

🧩 Shortcodes for Statiq site generator to show alerts

License

Notifications You must be signed in to change notification settings

swissgrc/Statiq.Alerts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Statiq.Alerts

License Build Downloads

Extension for Statiq site generator to add alerts.

Table of Contents

Install

  1. Add the Statiq.Alerts NuGet package to the Statiq project
  2. Call .AddAlertShortCodes() on the bootstrapper

Requirements

The extension requires that Bootstrap and FontAwesome are loaded by the Statiq theme.

Usage

See Using Shortcodes for detailed instructions how to use shortcodes in Statiq.

Tip

<?# Tip ?>
This is a tip
<?#/ Tip ?>

Shows a tip alert:

Tip alert

Info

<?# Info ?>
This is an info message
<?#/ Info ?>

Shows an info message:

Info alert

Note

<?# Note ?>
This is a note
<?#/ Note ?>

Shows a note:

Note alert

Warning

<?# Warning ?>
This is a warning
<?#/ Warning ?>

Shows a warning:

Warning alert

Important

<?# Important ?>
This is an important message
<?#/ Important ?>

Shows an important message:

Important alert

API

Custom Shortcuts

Additional custom shortcuts can be implemented by inheriting from the AlertShortcode class and define the DefaultAlertClass, DefaultAlertIcon and DefaultAlertTitle properties. See Parameters for documentation about possible values.

Parameters

The following parameters are available on all shortcuts and allow to override the default styling.

Class

The Class parameter allows to override the CSS class of the alert div element:

<?# Note Class="alert-secondary"?>
This is a note rendered in the secondary color
<?#/ Note ?>

The alert class will always be set.

Icon

Changing the icon

The Icon parameters allows to override the icon of the alert:

<?# Note Title="fa-check"?>
This is a note with a different icon
<?#/ Note ?>

Any Fontawesome icon can be used. The fa-solid class will always be set.

Removing the icon

To remove the icon the Icon parameter can be set to an empty string:

<?# Note Icon=""?>
This is a note without an icon
<?#/ Note ?>

Title

Changing the title

The Title parameters allows to override the title of the alert:

<?# Note Title="Custom Title"?>
This is a note with a custom title
<?#/ Note ?>
Removing the title

To remove the title the Title parameter can be set to an empty string:

<?# Note Title=""?>
This is a note without a title
<?#/ Note ?>

Contributing

We accept Pull Requests

License

MIT © Swiss GRC AG