File tree Expand file tree Collapse file tree 2 files changed +92
-0
lines changed Expand file tree Collapse file tree 2 files changed +92
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,18 @@ func createDefaultPolicy() *bluemonday.Policy {
94
94
// Allow 'color' and 'background-color' properties for the style attribute on text elements.
95
95
policy .AllowStyles ("color" , "background-color" ).OnElements ("span" , "p" )
96
96
97
+ // AsciiDoc: Allow classes for float-direction
98
+ policy .AllowAttrs ("class" ).Matching (regexp .MustCompile (`(^| )(text-)?(left|center|right)$` )).OnElements ("div" )
99
+
100
+ // AsciiDoc: Allow classes for admonition blocks
101
+ policy .AllowAttrs ("class" ).Matching (regexp .MustCompile (`^admonitionblock (note|tip|important|caution|warning)( |$)` )).OnElements ("div" )
102
+ policy .AllowAttrs ("class" ).Matching (regexp .MustCompile (`^title$` )).OnElements ("div" )
103
+ policy .AllowAttrs ("class" ).Matching (regexp .MustCompile (`^(icon|content)$` )).OnElements ("td" )
104
+
105
+ // AsciiDoc: Allow classes for table styling: borders and horizontal alignment
106
+ policy .AllowAttrs ("class" ).Matching (regexp .MustCompile (`^tableblock frame-(all|ends|sides|none) grid-(all|rows|cols|none)( |$)` )).OnElements ("table" )
107
+ policy .AllowAttrs ("class" ).Matching (regexp .MustCompile (`^tableblock halign-(left|center|right)( |$)` )).OnElements ("th" , "td" )
108
+
97
109
// Allow generally safe attributes
98
110
generalSafeAttrs := []string {
99
111
"abbr" , "accept" , "accept-charset" ,
Original file line number Diff line number Diff line change 558
558
border-top-left-radius : 0 !important ;
559
559
border-top-right-radius : 0 !important ;
560
560
}
561
+
562
+ .asciidoc {
563
+ .left {
564
+ float : left ;
565
+ }
566
+
567
+ .right {
568
+ float : right
569
+ }
570
+
571
+ .text-left ,
572
+ .halign-left {
573
+ text-align : left ;
574
+ }
575
+
576
+ .text-center ,
577
+ .halign-center {
578
+ text-align : center ;
579
+ }
580
+
581
+ .text-right ,
582
+ .halign-right {
583
+ text-align : right ;
584
+ }
585
+
586
+ table {
587
+ & .frame-none {
588
+ border-width : 0 !important ;
589
+ }
590
+
591
+ & .grid-none {
592
+ tr ,
593
+ th ,
594
+ td {
595
+ border-width : 0 !important ;
596
+ }
597
+ }
598
+ }
599
+
600
+ #user-content-toctitle {
601
+ font-weight : bold ;
602
+ }
603
+
604
+ .admonitionblock {
605
+ > table {
606
+ border : 0 !important ;
607
+ border-radius : 0.2em ;
608
+
609
+ tr ,
610
+ td {
611
+ border : 0 !important ;
612
+ }
613
+
614
+ .icon {
615
+ font-weight : bold ;
616
+ border-right : 0.1em solid !important ;
617
+ vertical-align : top ;
618
+ }
619
+
620
+ .content {
621
+ background-color : var (--color-body );
622
+ }
623
+ }
624
+
625
+ .admonition-colours () {
626
+ tip: var (--color-green );
627
+ note: var (--color-blue );
628
+ important: var (--color-red );
629
+ caution: var (--color-yellow );
630
+ warning: var (--color-orange );
631
+ }
632
+
633
+ each(.admonition-colours (), .(@colour , @class ) {
634
+ & .@{class} .icon {
635
+ color : @colour ;
636
+ background : linear-gradient (to left , @colour, transparent 0.5em );
637
+ }
638
+ })
639
+ }
640
+ }
You can’t perform that action at this time.
0 commit comments