File tree 2 files changed +42
-2
lines changed
2 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,26 @@ A.anchor{
94
94
visibility : hidden;
95
95
}
96
96
97
+ H1 , H2 , H3 , H4 , H5 {
98
+ margin-left : -1.2rem ;
99
+ }
100
+ H1 : hover .permalink > SPAN ,
101
+ H2 : hover .permalink > SPAN ,
102
+ H3 : hover .permalink > SPAN ,
103
+ H4 : hover .permalink > SPAN ,
104
+ H5 : hover .permalink > SPAN {
105
+ visibility : visible;
106
+ }
107
+ A .permalink {
108
+ float : left;
109
+ text-decoration : none;
110
+ margin-right : 0.2rem ;
111
+ }
112
+
113
+ A .permalink > SPAN {
114
+ visibility : hidden;
115
+ }
116
+
97
117
98
118
PRE CODE {color : # 465760 ;}
99
119
PRE .kw1 {color : # E06645 ; }
Original file line number Diff line number Diff line change @@ -55,11 +55,31 @@ public function getLevel(): int
55
55
return $ this ->level ;
56
56
}
57
57
58
- public function replace (string $ subject ) : string
58
+ /**
59
+ * Replaces the <hx> tag in the subject string with the adjusted
60
+ * markup for the permalink icon and jump anchor.
61
+ *
62
+ * @param string $subject
63
+ * @param DocFile $file
64
+ * @return string
65
+ */
66
+ public function replace (string $ subject , DocFile $ file ) : string
59
67
{
68
+ $ template =
69
+ '<h%1$s> ' .
70
+ '<a class="permalink" href="?doc=%3$s#%2$s"> ' .
71
+ '<span>§</span> ' .
72
+ '</a> ' .
73
+ '<a class="anchor" id="%2$s"></a> ' ;
74
+
60
75
$ new = str_replace (
61
76
sprintf ('<h%s> ' , $ this ->level ),
62
- sprintf ('<h%s><a class="anchor" id="%s"></a> ' , $ this ->level , $ this ->id ),
77
+ sprintf (
78
+ $ template ,
79
+ $ this ->level ,
80
+ $ this ->id ,
81
+ $ file ->getID ()
82
+ ),
63
83
$ this ->tag
64
84
);
65
85
You can’t perform that action at this time.
0 commit comments