docsify-plugin-flexible-alerts
Advanced tools
Comparing version 1.0.4 to 1.1.0
/*! | ||
* docsify-plugin-flexible-alerts | ||
* v1.0.4 | ||
* https://github.com/zanfab/docsify-plugin-flexible-alerts#readme | ||
* (c) 2019 Fabian Zankl | ||
* v1.1.0 | ||
* https://github.com/fzankl/docsify-plugin-flexible-alerts#readme | ||
* (c) 2020 Fabian Zankl | ||
* MIT license | ||
@@ -11,2 +11,3 @@ */ | ||
function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
@@ -47,4 +48,4 @@ _typeof = function(obj) { | ||
} | ||
var css = '@import url("https://use.fontawesome.com/releases/v5.6.3/css/solid.css");@import url("https://use.fontawesome.com/releases/v5.6.3/css/fontawesome.css");.alert{display:block;position:relative;word-wrap:break-word;word-break:break-word;padding:.75rem 1.25rem!important;margin-bottom:1rem!important}.alert>*{max-width:100%}.alert+.alert{margin-top:-.25rem!important}.alert:before{content:unset!important}.alert p{margin-top:.5rem;margin-bottom:.5rem}.alert i{margin-right:.5rem}.alert .title{font-weight:600;margin:0}.alert>:first-child{margin-top:0}.alert>:last-child{margin-bottom:0}.alert.callout{border:1px solid #eee;border-left-width:.25rem;border-radius:.25rem;background:#fff}.alert.callout.warning{border-left-color:#f0ad4e!important}.alert.callout.warning .title{color:#f0ad4e}.alert.callout.tip{border-left-color:#28a745!important}.alert.callout.tip .title{color:#28a745}.alert.callout.info{border-left-color:#17a2b8!important}.alert.callout.info .title{color:#17a2b8}.alert.callout.danger{border-left-color:#dc3545!important}.alert.callout.danger .title{color:#dc3545}.alert.flat{border-radius:.125rem;color:#383d41;background-color:#e2e3e5;border:1px solid #d6d8db}.alert.flat.info{color:#02587f;background-color:#cdeefd;border-color:#b8e7fc}.alert.flat.info .title{color:#01354d}.alert.flat.tip{color:#285b2a;background-color:#dbefdc;border-color:#cde9ce}.alert.flat.tip .title{color:#18381a}.alert.flat.warning{color:#852d12;background-color:#ffddd3;border-color:#ffd0c1}.alert.flat.warning .title{color:#581e0c}.alert.flat.danger{color:#7f231c;background-color:#fdd9d7;border-color:#fccac7}.alert.flat.danger .title{color:#551713}'; | ||
styleInject(css); | ||
var css_248z = ".alert{display:block;position:relative;word-wrap:break-word;word-break:break-word;padding:.75rem 1.25rem!important;margin-bottom:1rem!important}.alert>*{max-width:100%}.alert>:first-child{margin-top:0}.alert>:last-child{margin-bottom:0}.alert:before{content:unset!important}.alert+.alert{margin-top:-.25rem!important}.alert p{margin-top:.5rem;margin-bottom:.5rem}.alert .title{display:flex;align-items:center;flex-wrap:wrap;font-weight:600;margin:0}.icon{display:inline-block;width:16px;height:16px;background-repeat:no-repeat;margin-right:.5rem}.alert.callout{border:1px solid #eee;border-left-width:.25rem;border-radius:.25rem;background:var(--background)}.alert.callout.note{border-left-color:#17a2b8!important}.alert.callout.note .title{color:#17a2b8}.alert.callout.note .icon-note{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='1em' height='1em' viewBox='0 0 16 16' fill='%2317a2b8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' d='M8 16A8 8 0 108 0a8 8 0 000 16zm.93-9.412l-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM8 5.5a1 1 0 100-2 1 1 0 000 2z'/%3E%3C/svg%3E\")}.alert.callout.tip{border-left-color:#28a745!important}.alert.callout.tip .title{color:#28a745}.alert.callout.tip .icon-tip{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='1em' height='1em' viewBox='0 0 352 512' fill='%2328a745' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M96.06 454.35c.01 6.29 1.87 12.45 5.36 17.69l17.09 25.69a31.99 31.99 0 0026.64 14.28h61.71a31.99 31.99 0 0026.64-14.28l17.09-25.69a31.989 31.989 0 005.36-17.69l.04-38.35H96.01l.05 38.35zM0 176c0 44.37 16.45 84.85 43.56 115.78 16.52 18.85 42.36 58.23 52.21 91.45.04.26.07.52.11.78h160.24c.04-.26.07-.51.11-.78 9.85-33.22 35.69-72.6 52.21-91.45C335.55 260.85 352 220.37 352 176 352 78.61 272.91-.3 175.45 0 73.44.31 0 82.97 0 176zm176-80c-44.11 0-80 35.89-80 80 0 8.84-7.16 16-16 16s-16-7.16-16-16c0-61.76 50.24-112 112-112 8.84 0 16 7.16 16 16s-7.16 16-16 16z'/%3E%3C/svg%3E\")}.alert.callout.warning{border-left-color:#f0ad4e!important}.alert.callout.warning .title{color:#f0ad4e}.alert.callout.warning .icon-warning{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='1em' height='1em' viewBox='0 0 17 16' fill='%23f0ad4e' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' d='M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5a.905.905 0 00-.9.995l.35 3.507a.552.552 0 001.1 0l.35-3.507A.905.905 0 008 5zm.002 6a1 1 0 100 2 1 1 0 000-2z'/%3E%3C/svg%3E\")}.alert.callout.attention{border-left-color:#dc3545!important}.alert.callout.attention .title{color:#dc3545}.alert.callout.attention .icon-attention{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='1em' height='1em' viewBox='0 0 16 16' fill='%23dc3545' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' d='M8 15A7 7 0 108 1a7 7 0 000 14zm0 1A8 8 0 108 0a8 8 0 000 16z'/%3E%3Cpath fill-rule='evenodd' d='M11.354 4.646a.5.5 0 010 .708l-6 6a.5.5 0 01-.708-.708l6-6a.5.5 0 01.708 0z'/%3E%3C/svg%3E\")}.alert.flat{border-radius:.125rem;color:#383d41;background-color:#e2e3e5;border:1px solid #d6d8db}.alert.flat.note{color:#02587f;background-color:#cdeefd;border-color:#b4e6fc}.alert.flat.note .title{color:#01354d}.alert.flat.note .icon-note{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='1em' height='1em' viewBox='0 0 16 16' fill='%2301354d' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' d='M8 16A8 8 0 108 0a8 8 0 000 16zm.93-9.412l-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM8 5.5a1 1 0 100-2 1 1 0 000 2z'/%3E%3C/svg%3E\")}.alert.flat.tip{color:#285b2a;background-color:#dbefdc;border-color:#c9e7cb}.alert.flat.tip .title{color:#18381a}.alert.flat.tip .icon-tip{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='1em' height='1em' viewBox='0 0 352 512' fill='%2318381a' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M96.06 454.35c.01 6.29 1.87 12.45 5.36 17.69l17.09 25.69a31.99 31.99 0 0026.64 14.28h61.71a31.99 31.99 0 0026.64-14.28l17.09-25.69a31.989 31.989 0 005.36-17.69l.04-38.35H96.01l.05 38.35zM0 176c0 44.37 16.45 84.85 43.56 115.78 16.52 18.85 42.36 58.23 52.21 91.45.04.26.07.52.11.78h160.24c.04-.26.07-.51.11-.78 9.85-33.22 35.69-72.6 52.21-91.45C335.55 260.85 352 220.37 352 176 352 78.61 272.91-.3 175.45 0 73.44.31 0 82.97 0 176zm176-80c-44.11 0-80 35.89-80 80 0 8.84-7.16 16-16 16s-16-7.16-16-16c0-61.76 50.24-112 112-112 8.84 0 16 7.16 16 16s-7.16 16-16 16z'/%3E%3C/svg%3E\")}.alert.flat.warning{color:#852d12;background-color:#ffddd3;border-color:#ffc9ba}.alert.flat.warning .title{color:#581e0c}.alert.flat.warning .icon-warning{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='1em' height='1em' viewBox='0 0 17 16' fill='%23581e0c' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' d='M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5a.905.905 0 00-.9.995l.35 3.507a.552.552 0 001.1 0l.35-3.507A.905.905 0 008 5zm.002 6a1 1 0 100 2 1 1 0 000-2z'/%3E%3C/svg%3E\")}.alert.flat.attention{color:#7f231c;background-color:#fdd9d7;border-color:#fcc2bf}.alert.flat.attention .title{color:#551713}.alert.flat.attention .icon-attention{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='1em' height='1em' viewBox='0 0 16 16' fill='%23551713' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' d='M8 15A7 7 0 108 1a7 7 0 000 14zm0 1A8 8 0 108 0a8 8 0 000 16z'/%3E%3Cpath fill-rule='evenodd' d='M11.354 4.646a.5.5 0 010 .708l-6 6a.5.5 0 01-.708-.708l6-6a.5.5 0 01.708 0z'/%3E%3C/svg%3E\")}"; | ||
styleInject(css_248z); | ||
(function() { | ||
@@ -55,8 +56,8 @@ var CONFIG = { | ||
label: "Note", | ||
icon: "fas fa-info-circle", | ||
className: "info" | ||
icon: "icon-note", | ||
className: "note" | ||
}, | ||
tip: { | ||
label: "Tip", | ||
icon: "fas fa-lightbulb", | ||
icon: "icon-tip", | ||
className: "tip" | ||
@@ -66,9 +67,13 @@ }, | ||
label: "Warning", | ||
icon: "fas fa-exclamation-triangle", | ||
icon: "icon-warning", | ||
className: "warning" | ||
}, | ||
danger: { | ||
attention: { | ||
label: "Attention", | ||
icon: "fas fa-ban", | ||
className: "danger" | ||
icon: "icon-attention", | ||
className: "attention" | ||
}, | ||
typeMappings: { | ||
info: "note", | ||
danger: "attention" | ||
} | ||
@@ -102,2 +107,5 @@ }; | ||
var modifiedHtml = html.replace(/<\s*blockquote[^>]*>(?:<p>|[\S\n]*)?\[!(\w*)((?:\|[\w*:[\s\w\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF-]*)*?)\]([\s\S]*?)(?:<\/p>)?<\s*\/\s*blockquote>/g, function(match, key, settings, value) { | ||
if (!options[key.toLowerCase()] && options.typeMappings[key.toLowerCase()]) { | ||
key = options.typeMappings[key.toLowerCase()]; | ||
} | ||
var config = options[key.toLowerCase()]; | ||
@@ -128,4 +136,5 @@ if (!config) { | ||
} | ||
var iconTag = '<i class="'.concat(icon, '"></i>'); | ||
return '<div class="alert '.concat(style, " ").concat(className, '">\n <p class="title">\n ').concat(isIconVisible ? iconTag : "", "\n ").concat(isLabelVisible ? label : "", "\n </p>\n <p>").concat(value, "</p>\n </div>"); | ||
var iconTag = '<span class="icon '.concat(icon, '"></span>'); | ||
var titleTag = '<p class="title">'.concat(isIconVisible ? iconTag : "").concat(isLabelVisible ? label : "", "</p>"); | ||
return '<div class="alert '.concat(style, " ").concat(className, '">\n ').concat(isIconVisible || isLabelVisible ? titleTag : "", "\n <p>").concat(value, "</p>\n </div>"); | ||
}); | ||
@@ -132,0 +141,0 @@ next(modifiedHtml); |
/*! | ||
* docsify-plugin-flexible-alerts | ||
* v1.0.4 | ||
* https://github.com/zanfab/docsify-plugin-flexible-alerts#readme | ||
* (c) 2019 Fabian Zankl | ||
* v1.1.0 | ||
* https://github.com/fzankl/docsify-plugin-flexible-alerts#readme | ||
* (c) 2020 Fabian Zankl | ||
* MIT license | ||
*/ | ||
!function(){"use strict";function g(t){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var e;!function(t,e){void 0===e&&(e={});var o=e.insertAt;if(t&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===o&&r.firstChild?r.insertBefore(a,r.firstChild):r.appendChild(a),a.styleSheet?a.styleSheet.cssText=t:a.appendChild(document.createTextNode(t))}}('@import url("https://use.fontawesome.com/releases/v5.6.3/css/solid.css");@import url("https://use.fontawesome.com/releases/v5.6.3/css/fontawesome.css");.alert{display:block;position:relative;word-wrap:break-word;word-break:break-word;padding:.75rem 1.25rem!important;margin-bottom:1rem!important}.alert>*{max-width:100%}.alert+.alert{margin-top:-.25rem!important}.alert:before{content:unset!important}.alert p{margin-top:.5rem;margin-bottom:.5rem}.alert i{margin-right:.5rem}.alert .title{font-weight:600;margin:0}.alert>:first-child{margin-top:0}.alert>:last-child{margin-bottom:0}.alert.callout{border:1px solid #eee;border-left-width:.25rem;border-radius:.25rem;background:#fff}.alert.callout.warning{border-left-color:#f0ad4e!important}.alert.callout.warning .title{color:#f0ad4e}.alert.callout.tip{border-left-color:#28a745!important}.alert.callout.tip .title{color:#28a745}.alert.callout.info{border-left-color:#17a2b8!important}.alert.callout.info .title{color:#17a2b8}.alert.callout.danger{border-left-color:#dc3545!important}.alert.callout.danger .title{color:#dc3545}.alert.flat{border-radius:.125rem;color:#383d41;background-color:#e2e3e5;border:1px solid #d6d8db}.alert.flat.info{color:#02587f;background-color:#cdeefd;border-color:#b8e7fc}.alert.flat.info .title{color:#01354d}.alert.flat.tip{color:#285b2a;background-color:#dbefdc;border-color:#cde9ce}.alert.flat.tip .title{color:#18381a}.alert.flat.warning{color:#852d12;background-color:#ffddd3;border-color:#ffd0c1}.alert.flat.warning .title{color:#581e0c}.alert.flat.danger{color:#7f231c;background-color:#fdd9d7;border-color:#fccac7}.alert.flat.danger .title{color:#551713}'),e={style:"callout",note:{label:"Note",icon:"fas fa-info-circle",className:"info"},tip:{label:"Tip",icon:"fas fa-lightbulb",className:"tip"},warning:{label:"Warning",icon:"fas fa-exclamation-triangle",className:"warning"},danger:{label:"Attention",icon:"fas fa-ban",className:"danger"}},window.$docsify=window.$docsify||{},window.$docsify.plugins=[].concat(function(t,b){function m(t,e,o,r){var a=(t||"").match(new RegExp("".concat(e,":(([\\s\\w\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF-]*))")));return a?r?r(a[1]):a[1]:r?r(o):o}var p=function t(e,o,r){var a=2<arguments.length&&void 0!==r?r:0;for(var l in o)try{o[l].constructor===Object&&a<1?e[l]=t(e[l],o[l],a+1):e[l]=o[l]}catch(t){e[l]=o[l]}return e}(e,b.config["flexible-alerts"]||b.config.flexibleAlerts);t.afterEach(function(t,e){e(t.replace(/<\s*blockquote[^>]*>(?:<p>|[\S\n]*)?\[!(\w*)((?:\|[\w*:[\s\w\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF-]*)*?)\]([\s\S]*?)(?:<\/p>)?<\s*\/\s*blockquote>/g,function(t,e,o,r){var a=p[e.toLowerCase()];if(!a)return t;var l=m(o,"style",p.style),n=m(o,"iconVisibility","visible",function(t){return"hidden"!==t}),c=m(o,"labelVisibility","visible",function(t){return"hidden"!==t}),i=m(o,"label",a.label),d=m(o,"icon",a.icon),s=m(o,"className",a.className);if("object"===g(i)){var f=Object.keys(i).filter(function(t){return-1<b.route.path.indexOf(t)});f&&0<f.length?i=i[f[0]]:n=c=!1}var u='<i class="'.concat(d,'"></i>');return'<div class="alert '.concat(l," ").concat(s,'">\n <p class="title">\n ').concat(n?u:"","\n ").concat(c?i:"","\n </p>\n <p>").concat(r,"</p>\n </div>")}))})},window.$docsify.plugins)}(); | ||
!function(){"use strict";function h(t){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var e;!function(t,e){void 0===e&&(e={});var a,l,o=e.insertAt;t&&"undefined"!=typeof document&&(a=document.head||document.getElementsByTagName("head")[0],(l=document.createElement("style")).type="text/css","top"===o&&a.firstChild?a.insertBefore(l,a.firstChild):a.appendChild(l),l.styleSheet?l.styleSheet.cssText=t:l.appendChild(document.createTextNode(t)))}(".alert{display:block;position:relative;word-wrap:break-word;word-break:break-word;padding:.75rem 1.25rem!important;margin-bottom:1rem!important}.alert>*{max-width:100%}.alert>:first-child{margin-top:0}.alert>:last-child{margin-bottom:0}.alert:before{content:unset!important}.alert+.alert{margin-top:-.25rem!important}.alert p{margin-top:.5rem;margin-bottom:.5rem}.alert .title{display:flex;align-items:center;flex-wrap:wrap;font-weight:600;margin:0}.icon{display:inline-block;width:16px;height:16px;background-repeat:no-repeat;margin-right:.5rem}.alert.callout{border:1px solid #eee;border-left-width:.25rem;border-radius:.25rem;background:var(--background)}.alert.callout.note{border-left-color:#17a2b8!important}.alert.callout.note .title{color:#17a2b8}.alert.callout.note .icon-note{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='1em' height='1em' viewBox='0 0 16 16' fill='%2317a2b8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' d='M8 16A8 8 0 108 0a8 8 0 000 16zm.93-9.412l-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM8 5.5a1 1 0 100-2 1 1 0 000 2z'/%3E%3C/svg%3E\")}.alert.callout.tip{border-left-color:#28a745!important}.alert.callout.tip .title{color:#28a745}.alert.callout.tip .icon-tip{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='1em' height='1em' viewBox='0 0 352 512' fill='%2328a745' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M96.06 454.35c.01 6.29 1.87 12.45 5.36 17.69l17.09 25.69a31.99 31.99 0 0026.64 14.28h61.71a31.99 31.99 0 0026.64-14.28l17.09-25.69a31.989 31.989 0 005.36-17.69l.04-38.35H96.01l.05 38.35zM0 176c0 44.37 16.45 84.85 43.56 115.78 16.52 18.85 42.36 58.23 52.21 91.45.04.26.07.52.11.78h160.24c.04-.26.07-.51.11-.78 9.85-33.22 35.69-72.6 52.21-91.45C335.55 260.85 352 220.37 352 176 352 78.61 272.91-.3 175.45 0 73.44.31 0 82.97 0 176zm176-80c-44.11 0-80 35.89-80 80 0 8.84-7.16 16-16 16s-16-7.16-16-16c0-61.76 50.24-112 112-112 8.84 0 16 7.16 16 16s-7.16 16-16 16z'/%3E%3C/svg%3E\")}.alert.callout.warning{border-left-color:#f0ad4e!important}.alert.callout.warning .title{color:#f0ad4e}.alert.callout.warning .icon-warning{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='1em' height='1em' viewBox='0 0 17 16' fill='%23f0ad4e' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' d='M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5a.905.905 0 00-.9.995l.35 3.507a.552.552 0 001.1 0l.35-3.507A.905.905 0 008 5zm.002 6a1 1 0 100 2 1 1 0 000-2z'/%3E%3C/svg%3E\")}.alert.callout.attention{border-left-color:#dc3545!important}.alert.callout.attention .title{color:#dc3545}.alert.callout.attention .icon-attention{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='1em' height='1em' viewBox='0 0 16 16' fill='%23dc3545' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' d='M8 15A7 7 0 108 1a7 7 0 000 14zm0 1A8 8 0 108 0a8 8 0 000 16z'/%3E%3Cpath fill-rule='evenodd' d='M11.354 4.646a.5.5 0 010 .708l-6 6a.5.5 0 01-.708-.708l6-6a.5.5 0 01.708 0z'/%3E%3C/svg%3E\")}.alert.flat{border-radius:.125rem;color:#383d41;background-color:#e2e3e5;border:1px solid #d6d8db}.alert.flat.note{color:#02587f;background-color:#cdeefd;border-color:#b4e6fc}.alert.flat.note .title{color:#01354d}.alert.flat.note .icon-note{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='1em' height='1em' viewBox='0 0 16 16' fill='%2301354d' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' d='M8 16A8 8 0 108 0a8 8 0 000 16zm.93-9.412l-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM8 5.5a1 1 0 100-2 1 1 0 000 2z'/%3E%3C/svg%3E\")}.alert.flat.tip{color:#285b2a;background-color:#dbefdc;border-color:#c9e7cb}.alert.flat.tip .title{color:#18381a}.alert.flat.tip .icon-tip{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='1em' height='1em' viewBox='0 0 352 512' fill='%2318381a' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M96.06 454.35c.01 6.29 1.87 12.45 5.36 17.69l17.09 25.69a31.99 31.99 0 0026.64 14.28h61.71a31.99 31.99 0 0026.64-14.28l17.09-25.69a31.989 31.989 0 005.36-17.69l.04-38.35H96.01l.05 38.35zM0 176c0 44.37 16.45 84.85 43.56 115.78 16.52 18.85 42.36 58.23 52.21 91.45.04.26.07.52.11.78h160.24c.04-.26.07-.51.11-.78 9.85-33.22 35.69-72.6 52.21-91.45C335.55 260.85 352 220.37 352 176 352 78.61 272.91-.3 175.45 0 73.44.31 0 82.97 0 176zm176-80c-44.11 0-80 35.89-80 80 0 8.84-7.16 16-16 16s-16-7.16-16-16c0-61.76 50.24-112 112-112 8.84 0 16 7.16 16 16s-7.16 16-16 16z'/%3E%3C/svg%3E\")}.alert.flat.warning{color:#852d12;background-color:#ffddd3;border-color:#ffc9ba}.alert.flat.warning .title{color:#581e0c}.alert.flat.warning .icon-warning{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='1em' height='1em' viewBox='0 0 17 16' fill='%23581e0c' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' d='M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5a.905.905 0 00-.9.995l.35 3.507a.552.552 0 001.1 0l.35-3.507A.905.905 0 008 5zm.002 6a1 1 0 100 2 1 1 0 000-2z'/%3E%3C/svg%3E\")}.alert.flat.attention{color:#7f231c;background-color:#fdd9d7;border-color:#fcc2bf}.alert.flat.attention .title{color:#551713}.alert.flat.attention .icon-attention{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='1em' height='1em' viewBox='0 0 16 16' fill='%23551713' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' d='M8 15A7 7 0 108 1a7 7 0 000 14zm0 1A8 8 0 108 0a8 8 0 000 16z'/%3E%3Cpath fill-rule='evenodd' d='M11.354 4.646a.5.5 0 010 .708l-6 6a.5.5 0 01-.708-.708l6-6a.5.5 0 01.708 0z'/%3E%3C/svg%3E\")}"),e={style:"callout",note:{label:"Note",icon:"icon-note",className:"note"},tip:{label:"Tip",icon:"icon-tip",className:"tip"},warning:{label:"Warning",icon:"icon-warning",className:"warning"},attention:{label:"Attention",icon:"icon-attention",className:"attention"},typeMappings:{info:"note",danger:"attention"}},window.$docsify=window.$docsify||{},window.$docsify.plugins=[].concat(function(t,f){function p(t,e,a,l){var o=(t||"").match(new RegExp("".concat(e,":(([\\s\\w\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF-]*))")));return o?l?l(o[1]):o[1]:l?l(a):a}var w=function t(e,a,l){var o,r=2<arguments.length&&void 0!==l?l:0;for(o in a)try{a[o].constructor===Object&&r<1?e[o]=t(e[o],a[o],r+1):e[o]=a[o]}catch(t){e[o]=a[o]}return e}(e,f.config["flexible-alerts"]||f.config.flexibleAlerts);t.afterEach(function(t,e){e(t.replace(/<\s*blockquote[^>]*>(?:<p>|[\S\n]*)?\[!(\w*)((?:\|[\w*:[\s\w\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF-]*)*?)\]([\s\S]*?)(?:<\/p>)?<\s*\/\s*blockquote>/g,function(t,e,a,l){!w[e.toLowerCase()]&&w.typeMappings[e.toLowerCase()]&&(e=w.typeMappings[e.toLowerCase()]);var o=w[e.toLowerCase()];if(!o)return t;var r,n=p(a,"style",w.style),i=p(a,"iconVisibility","visible",function(t){return"hidden"!==t}),c=p(a,"labelVisibility","visible",function(t){return"hidden"!==t}),d=p(a,"label",o.label),s=p(a,"icon",o.icon),g=p(a,"className",o.className);"object"===h(d)&&((r=Object.keys(d).filter(function(t){return-1<f.route.path.indexOf(t)}))&&0<r.length?d=d[r[0]]:i=c=!1);var m='<span class="icon '.concat(s,'"></span>'),u='<p class="title">'.concat(i?m:"").concat(c?d:"","</p>");return'<div class="alert '.concat(n," ").concat(g,'">\n ').concat(i||c?u:"","\n <p>").concat(l,"</p>\n </div>")}))})},window.$docsify.plugins)}(); | ||
//# sourceMappingURL=docsify-plugin-flexible-alerts.min.js.map |
{ | ||
"name": "docsify-plugin-flexible-alerts", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"description": "docsify plugin to convert blockquotes into beautiful and configurable alerts using preconfigured or own styles and alert types.", | ||
@@ -27,15 +27,17 @@ "keywords": [ | ||
}, | ||
"homepage": "https://github.com/zanfab/docsify-plugin-flexible-alerts#readme", | ||
"homepage": "https://github.com/fzankl/docsify-plugin-flexible-alerts#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/zanfab/docsify-plugin-flexible-alerts.git" | ||
"url": "git+https://github.com/fzankl/docsify-plugin-flexible-alerts.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/zanfab/docsify-plugin-flexible-alerts/issues" | ||
"url": "https://github.com/fzankl/docsify-plugin-flexible-alerts/issues" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.6.0", | ||
"@babel/preset-env": "^7.6.0", | ||
"@fortawesome/fontawesome-free": "^5.11.1", | ||
"@fortawesome/free-regular-svg-icons": "^5.11.1", | ||
"@babel/core": "^7.11.6", | ||
"@babel/preset-env": "^7.11.5", | ||
"@fortawesome/fontawesome-free": "^5.14.0", | ||
"@fortawesome/free-regular-svg-icons": "^5.14.0", | ||
"@rollup/plugin-babel": "^5.2.1", | ||
"@rollup/plugin-url": "^5.0.1", | ||
"autoprefixer": "^8.2.0", | ||
@@ -45,4 +47,4 @@ "eslint": "^5.16.0", | ||
"rimraf": "^2.7.1", | ||
"rollup": "^1.21.4", | ||
"rollup-plugin-babel": "^4.3.3", | ||
"rollup": "^1.32.1", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"rollup-plugin-commonjs": "^9.3.4", | ||
@@ -52,6 +54,8 @@ "rollup-plugin-eslint": "^5.1.0", | ||
"rollup-plugin-node-resolve": "^4.2.4", | ||
"rollup-plugin-postcss": "^2.0.3", | ||
"rollup-plugin-uglify": "^6.0.3", | ||
"rollup-plugin-url": "^2.2.2" | ||
} | ||
"rollup-plugin-postcss": "^2.9.0", | ||
"rollup-plugin-scss": "^2.6.0", | ||
"rollup-plugin-uglify": "^6.0.4", | ||
"rollup-plugin-url": "^2.2.4" | ||
}, | ||
"dependencies": {} | ||
} |
208
README.md
@@ -9,5 +9,5 @@ # docsify plugin: Flexible Alerts | ||
![Sample alerts created with plugin 'flexible-alerts'](https://user-images.githubusercontent.com/44210522/50688702-ea774f00-1026-11e9-9281-ca615cb466f5.jpg) | ||
![Sample alerts created with plugin 'flexible-alerts'](https://user-images.githubusercontent.com/44210522/93708131-10fb5780-fb34-11ea-85ae-e18b3e239f83.jpg) | ||
## Installation | ||
## Installation and Usage | ||
@@ -19,87 +19,121 @@ ### Step #1 - Update `index.html` file | ||
1. Add the following script tag to your `index.html` | ||
2. In docsify setup 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 `index.html` or for a single alert in your markdown files. | ||
```html | ||
<!-- Latest --> | ||
<script src="https://unpkg.com/docsify-plugin-flexible-alerts"></script> | ||
``` | ||
```html | ||
<!-- Latest --> | ||
<script src="https://unpkg.com/docsify-plugin-flexible-alerts"></script> | ||
``` | ||
**Sample `index.html` file using style `flat` instead of `callout`** | ||
2. In docsify setup configure the plugin so it does fit your needs. A custom setup is not mandatory. By default styles `flat` and `callout` (Default: `callout`) and types `NOTE`, `TIP`, `WARNING` and `ATTENTION` are supported. | ||
```javascript | ||
<script> | ||
window.$docsify = { | ||
'flexible-alerts': { | ||
style: 'flat' | ||
} | ||
}; | ||
</script> | ||
``` | ||
You can change it using plugin configuration via `index.html` or for a single alert in your markdown files. (please see section `Customizations` for further details) | ||
**Sample `index.html` using custom headings** | ||
**Sample `index.html` file using style `flat` instead of `callout`** | ||
```javascript | ||
<script> | ||
window.$docsify = { | ||
'flexible-alerts': { | ||
note: { | ||
label: "Hinweis" | ||
}, | ||
tip: { | ||
label: "Tipp" | ||
}, | ||
warning: { | ||
label: "Warnung" | ||
}, | ||
danger: { | ||
label: "Achtung" | ||
} | ||
} | ||
}; | ||
</script> | ||
``` | ||
```javascript | ||
<script> | ||
window.$docsify = { | ||
'flexible-alerts': { | ||
style: 'flat' | ||
} | ||
}; | ||
</script> | ||
``` | ||
**Sample `index.html` using multilingual headings** | ||
**Sample `index.html` using custom headings** | ||
```javascript | ||
<script> | ||
window.$docsify = { | ||
'flexible-alerts': { | ||
note: { | ||
label: { | ||
'/de-DE/': 'Hinweis', | ||
'/': 'Note' | ||
```javascript | ||
<script> | ||
window.$docsify = { | ||
'flexible-alerts': { | ||
note: { | ||
label: "Hinweis" | ||
}, | ||
tip: { | ||
label: "Tipp" | ||
}, | ||
warning: { | ||
label: "Warnung" | ||
}, | ||
attention: { | ||
label: "Achtung" | ||
} | ||
} | ||
}, | ||
tip: { | ||
label: { | ||
'/de-DE/': 'Tipp', | ||
'/': 'Tip' | ||
}; | ||
</script> | ||
``` | ||
**Sample `index.html` using multilingual headings** | ||
```javascript | ||
<script> | ||
window.$docsify = { | ||
'flexible-alerts': { | ||
note: { | ||
label: { | ||
'/de-DE/': 'Hinweis', | ||
'/': 'Note' | ||
} | ||
}, | ||
tip: { | ||
label: { | ||
'/de-DE/': 'Tipp', | ||
'/': 'Tip' | ||
} | ||
}, | ||
warning: { | ||
label: { | ||
'/de-DE/': 'Warnung', | ||
'/': 'Warning' | ||
} | ||
}, | ||
attention: { | ||
label: { | ||
'/de-DE/': 'Achtung', | ||
'/': 'Attention' | ||
} | ||
} | ||
} | ||
}, | ||
warning: { | ||
label: { | ||
'/de-DE/': 'Warnung', | ||
'/': 'Warning' | ||
} | ||
}, | ||
danger: { | ||
label: { | ||
'/de-DE/': 'Achtung', | ||
'/': 'Attention' | ||
} | ||
} | ||
} | ||
}; | ||
</script> | ||
``` | ||
}; | ||
</script> | ||
``` | ||
### Step #2 - docsify commands | ||
### Step #2 - Prepare documentation | ||
Modify or add a new blockquote so it matches required syntax like shown in following examples: | ||
* Sample alert using type `NOTE` | ||
```markdown | ||
> [!NOTE] | ||
> An alert of type 'note' using global style 'callout'. | ||
``` | ||
* Sample alert using type `TIP` | ||
```markdown | ||
> [!TIP] | ||
> An alert of type 'tip' using global style 'callout'. | ||
``` | ||
* Sample alert using type `WARNING` | ||
```markdown | ||
> [!WARNING] | ||
> An alert of type 'warning' using global style 'callout'. | ||
``` | ||
* Sample alert using type `ATTENTION` | ||
```markdown | ||
> [!ATTENTION] | ||
> An alert of type 'attention' using global style 'callout'. | ||
``` | ||
### Step #3 - docsify commands | ||
Serve your documentation (`docsify serve`) as usual. | ||
## Usage | ||
## Customizations | ||
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). | ||
To use the plugin just modify an existing blockquote and prepend a line matching pattern `[!type]`. By default types `NOTE`, `TIP`, `WARNING` and `ATTENTION` are supported. You can extend the available types by providing a valid configuration (see below for an example). | ||
@@ -144,3 +178,3 @@ ```markdown | ||
comment: { | ||
label: "Comment", | ||
label: 'Comment', | ||
@@ -154,4 +188,4 @@ // localization | ||
// Assuming that we use Font Awesome | ||
icon: "fas fa-comment", | ||
className: "info" | ||
icon: 'fas fa-comment', | ||
className: 'note' | ||
} | ||
@@ -163,2 +197,4 @@ } | ||
**Since we are using FontAwesome in previous example we have to include the library via `index.html`, e.g. using a CDN.** | ||
In Markdown just use the alert according to the types provided by default. | ||
@@ -191,10 +227,20 @@ | ||
09/23/2019 - Fixed issue concerning custom Font Awesome icons when using on alert based level. | ||
09/20/2020 | ||
* Removed dependency to FontAwesome and embedded icons as SVG directly. | ||
* Support dark mode for callout alert style. | ||
* Moved alert type naming from 'danger' to 'attention'. Introduced type mappings to support mapping further alert type keys to existing definitions, e.g. map legacy alert type 'danger' to new type definition 'attention'. | ||
04/14/2019 - Added camel case support for plugin configuration key. | ||
09/23/2019 | ||
* Fixed issue concerning custom Font Awesome icons when using on alert based level. | ||
03/03/2019 - Fixed issue concerning languages using characters others than [a-z,A-Z,0-9] like Chinese or Russian. | ||
04/14/2019 | ||
* Added camel case support for plugin configuration key. | ||
01/19/2019 - Fixed issue when using plugin along with themeable plugin. | ||
03/03/2019 | ||
* Fixed issue concerning languages using characters others than [a-z,A-Z,0-9] like Chinese or Russian. | ||
01/06/2019 - Initial release. | ||
01/19/2019 | ||
* Fixed issue when using plugin along with themeable plugin. | ||
01/06/2019 | ||
* Initial release. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46022
202
240
20