Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

docs: Add anchor links next to each function

Modify doctool.js to automatically create anchor links for
every function, for easy linking.
Include support for functions that have a <h4> level

Fixes: #1718.
  • Loading branch information...
commit 97d355c273583ec6226ab3f4f49bc909164bf801 1 parent b93a7cc
@vitorbal vitorbal authored koichik committed
Showing with 13 additions and 1 deletion.
  1. +10 −1 doc/api_assets/style.css
  2. +3 −0  tools/doctool/doctool.js
View
11 doc/api_assets/style.css
@@ -126,6 +126,15 @@ h4 + h4 {
margin: 0 0 0.5em;
}
+ h3 a,
+ h4 a {
+ font-size: 0.8em;
+ float: right;
+ color: #000;
+ text-decoration: none;
+ opacity: 0.3;
+ }
+
h5 {
font-size: 1.125em;
line-height: 1.4em;
@@ -232,4 +241,4 @@ a.octothorpe {
h5:hover > a.octothorpe,
h6:hover > a.octothorpe {
opacity: 1;
- }
+ }
View
3  tools/doctool/doctool.js
@@ -88,6 +88,9 @@ function convertData(data) {
.replace(/<hr><\/hr>/g, "<hr />")
.replace(/(\<h[2-6])\>([^<]+)(\<\/h[1-6]\>)/gmi, function(o, ts, c, te) {
return ts+' id="'+formatIdString(c)+'">'+c+te;
+ })
+ .replace(/(\<h[3-4][^>]+\>)([^<]+)(\<\/h[3-4]\>)/gmi, function(o, ts, c, te) {
+ return ts+c+' <a href="#'+formatIdString(c)+'">#</a>'+te;
});
return html;
Please sign in to comment.
Something went wrong with that request. Please try again.