Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
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
vitorbal authored and koichik committed Sep 21, 2011
1 parent b93a7cc commit 97d355c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion doc/api_assets/style.css
Expand Up @@ -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;
Expand Down Expand Up @@ -232,4 +241,4 @@ a.octothorpe {
h5:hover > a.octothorpe,
h6:hover > a.octothorpe {
opacity: 1;
}
}
3 changes: 3 additions & 0 deletions tools/doctool/doctool.js
Expand Up @@ -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;
Expand Down

0 comments on commit 97d355c

Please sign in to comment.