@@ -7,11 +7,11 @@ import { h } from 'hastscript'
77import octicons from '@primer/octicons'
88
99const alertTypes = {
10- NOTE : { icon : 'info' , color : 'accent' , title : 'Note' } ,
11- IMPORTANT : { icon : 'report' , color : 'done' , title : 'Important' } ,
12- WARNING : { icon : 'alert' , color : 'attention' , title : 'Warning' } ,
13- TIP : { icon : 'light-bulb' , color : 'success' , title : 'Tip' } ,
14- CAUTION : { icon : 'stop' , color : 'danger' , title : 'Caution' } ,
10+ NOTE : { icon : 'info' , color : 'accent' } ,
11+ IMPORTANT : { icon : 'report' , color : 'done' } ,
12+ WARNING : { icon : 'alert' , color : 'attention' } ,
13+ TIP : { icon : 'light-bulb' , color : 'success' } ,
14+ CAUTION : { icon : 'stop' , color : 'danger' } ,
1515}
1616
1717// Must contain one of [!NOTE], [!IMPORTANT], ...
@@ -22,7 +22,7 @@ const matcher = (node) =>
2222 node . tagName === 'blockquote' &&
2323 ALERT_REGEXP . test ( JSON . stringify ( node . children ) )
2424
25- export default function alerts ( ) {
25+ export default function alerts ( { alertTitles = { } } ) {
2626 return ( tree ) => {
2727 visit ( tree , matcher , ( node ) => {
2828 const key = getAlertKey ( node )
@@ -35,7 +35,12 @@ export default function alerts() {
3535 node . tagName = 'div'
3636 node . properties . className = 'ghd-alert ghd-alert-' + alertType . color
3737 node . children = [
38- h ( 'p' , { className : 'ghd-alert-title' } , getOcticonSVG ( alertType . icon ) , alertType . title ) ,
38+ h (
39+ 'p' ,
40+ { className : 'ghd-alert-title' } ,
41+ getOcticonSVG ( alertType . icon ) ,
42+ alertTitles [ key ] || '' ,
43+ ) ,
3944 ...removeAlertSyntax ( node . children ) ,
4045 ]
4146 } )
0 commit comments