All Projects → fzankl → gitbook-plugin-flexible-alerts

fzankl / gitbook-plugin-flexible-alerts

Licence: MIT license
GitBook plugin to convert blockquotes into beautiful and configurable alerts using preconfigured or own styles and alert types.

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to gitbook-plugin-flexible-alerts

awesome-gitbook-plugins
📚 Supercharge your books with the best of GitBook plugins!
Stars: ✭ 44 (+51.72%)
Mutual labels:  gitbook, gitbook-plugin
myBook
使用GitBook记录开发笔记
Stars: ✭ 30 (+3.45%)
Mutual labels:  gitbook, gitbook-plugin
gitbook-plugin-autotheme
GitBook自动换肤插件
Stars: ✭ 13 (-55.17%)
Mutual labels:  gitbook, gitbook-plugin
Hint
重构到 ---> https://github.com/hustcc/lint-md
Stars: ✭ 30 (+3.45%)
Mutual labels:  gitbook, hint
remark-admonitions
Add admonitions support to Remarkable
Stars: ✭ 90 (+210.34%)
Mutual labels:  alert, callout
gitbook-treeview
🌲 A gitbook plugin for generating tree view for ech page
Stars: ✭ 38 (+31.03%)
Mutual labels:  gitbook, gitbook-plugin
Jspanel4
A JavaScript library to create highly configurable floating panels, modals, tooltips, hints/notifiers/alerts or contextmenus for use in backend solutions and other web applications.
Stars: ✭ 217 (+648.28%)
Mutual labels:  alert, hint
gitbook-plugin-atoc
A TOC plugin for GitBook
Stars: ✭ 22 (-24.14%)
Mutual labels:  gitbook, gitbook-plugin
cuc-ns
网络安全课本
Stars: ✭ 42 (+44.83%)
Mutual labels:  gitbook
FreeBSD-Ask
FreeBSD 教程——FreeBSD 从入门到跑路。
Stars: ✭ 113 (+289.66%)
Mutual labels:  gitbook
vue2-dialog
A mobile Vue plugin for VueDialog
Stars: ✭ 21 (-27.59%)
Mutual labels:  alert
learn-swift-with-bob
Learn Swift 4 with Bob: Intermediate to Advanced Swift 4 Course
Stars: ✭ 22 (-24.14%)
Mutual labels:  gitbook
CLI-Autocomplete
Cross-platform flexible autocomplete library for your CLI applications.
Stars: ✭ 21 (-27.59%)
Mutual labels:  hint
installation-guides
Centralized administration of dependency installation guides.
Stars: ✭ 59 (+103.45%)
Mutual labels:  gitbook
JDropDownAlert
Simple DropDown Alert View For Any iOS Projects.
Stars: ✭ 71 (+144.83%)
Mutual labels:  alert
slackcat
A simple way of sending messages from the CLI output to your Slack with webhook.
Stars: ✭ 102 (+251.72%)
Mutual labels:  alert
soldoc
A solidity documentation generator, based in NatSpec format. 📃 with standalone HTML, pdf, gitbook and docsify output ✏️ just plug and play.
Stars: ✭ 54 (+86.21%)
Mutual labels:  gitbook
spark-alarm
Alerting and monitoring tool for Apache Spark
Stars: ✭ 23 (-20.69%)
Mutual labels:  alert
TezAlertView
Custom singleton alertView with block completion.
Stars: ✭ 17 (-41.38%)
Mutual labels:  alert
react-redux-modal-flex
[DEPRECATED] Make easy a modal/popup with Redux
Stars: ✭ 14 (-51.72%)
Mutual labels:  alert

GitBook plugin: Flexible Alerts

Build Status npm version npm Downloads

This GitBook plugin converts blockquotes into beautiful alerts. Look and feel can be configured on a global as well as on a alert specific level so output does fit your needs (some examples are shown below). In addition, you can provide own alert types.

Sample alerts created with plugin 'flexible-alerts'

Installation

Step #1 - Update book.json file

  1. In you gitbook's book.json file, add flexible-alerts to plugins list.
  2. In pluginsConfig, configure the plugin so it does fit your needs. A custom setup is not mandatory.
  3. By default style 'callout' and headings 'Note', 'Tip', 'Warning', 'Attention' will be used. You can change it using plugin configuration via book.json or for a single alert in your markdown files.

Sample book.json file for gitbook version 2.0.0+

{
  "plugins": [
    "flexible-alerts"
  ]
}

Sample book.json file for gitbook version 2.0.0+ and style flat instead of callout

{
  "plugins": [
    "flexible-alerts"
  ],
  "pluginsConfig": {
    "flexible-alerts": {
      "style": "flat"
    }
  }
}

Sample book.json file for gitbook version 2.0.0+ and custom headings

{
  "plugins": [
    "flexible-alerts"
  ],
  "pluginsConfig": {
    "flexible-alerts": {
      "note": {
        "label": "Hinweis"
      },
      "tip": {
        "label": "Tipp"
      },
      "warning": {
        "label": "Warnung"
      },
      "danger": {
        "label": "Achtung"
      }
    }
  }
}

Sample book.json file for gitbook version 2.0.0+ and multilingual headings

{
  "plugins": [
    "flexible-alerts"
  ],
  "pluginsConfig": {
    "flexible-alerts": {
      "note": {
        "label": {
          "de": "Hinweis",
          "en": "Note"
        }
      },
      "tip": {
        "label": {
          "de": "Tipp",
          "en": "Tip"
        }
      },
      "warning": {
        "label": {
          "de": "Warnung",
          "en": "Warning"
        }
      },
      "danger": {
        "label": {
          "de": "Achtung",
          "en": "Attention"
        }
      }
    }
  }
}

Note: Above snippets can be used as complete book.json file, if one of these matches your requirements and your book doesn't have one yet.

Step #2 - gitbook commands

  1. Run gitbook install. It will automatically install flexible-alerts gitbook plugin for your book. This is needed only once.
  2. Build your book (gitbook build) or serve (gitbook serve) as usual.

Usage

To use the plugin just modify an existing blockquote and prepend a line matching pattern [!type]. By default types NOTE, TIP, WARNING and DANGER are supported. You can extend the available types by providing a valid configuration (see below for an example).

> [!NOTE]
> An alert of type 'note' using global style 'callout'.
> [!NOTE|style:flat]
> An alert of type 'note' using alert specific style 'flat' which overrides global style 'callout'.

As you can see in the second snippet, output can be configured on alert level also. Supported options are listed in following table:

Key Allowed value
style One of follwowing values: callout, flat
label Any text
icon A valid Font Awesome icon, e.g. 'fa fa-info-circle'
className A name of a CSS class which specifies the look and feel
labelVisibility One of follwowing values: visible (default), hidden
iconVisibility One of follwowing values: visible (default), hidden

Multiple options can be used for single alerts as shown below:

> [!TIP|style:flat|label:My own heading|iconVisibility:hidden]
> An alert of type 'tip' using alert specific style 'flat' which overrides global style 'callout'.
> In addition, this alert uses an own heading and hides specific icon.

Custom alert

As mentioned above you can provide your own alert types. Therefore, you have to provide the type configuration via book.json. Following example shows an additional type COMMENT.

{
  "plugins": [
    "flexible-alerts"
  ],
  "pluginsConfig": {
    "flexible-alerts": {
      "style": "callout",
      "comment": {
        "label": "Comment",
        "icon": "fa fa-comments",
        "className": "info"
      }
    }
  }
}

In Markdown just use the alert according to the types provided by default.

> [!COMMENT]
> An alert of type 'comment' using style 'callout' with default settings.

Custom alert type 'comment'

Troubleshooting

If alerts do not look as expected, check if your book.json as well as alerts in Markdown are valid according to this documentation.

Changelog

08/15/2022 - Fixed code smell in stylesheet file and updated development dependencies

04/08/2019 - Fixed issue concerning languages using characters others than [a-z,A-Z,0-9] like Chinese or Russian

02/24/2019 - Added support for Internet Explorer 11

01/07/2019 - Moved complete icon definition to pluginsConfig section

01/05/2019 - Initial Release

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].