diff options
author | Vitor Balocco <vitorbal@gmail.com> | 2011-09-16 01:22:05 +0400 |
---|---|---|
committer | koichik <koichik@improvement.jp> | 2011-09-21 16:08:53 +0400 |
commit | 97d355c273583ec6226ab3f4f49bc909164bf801 (patch) | |
tree | 7c1e2fd5b59b1a6c7d566895a99e04deff02a57c | |
parent | b93a7cc99e0251a2bfc2e4851b833faac49260d2 (diff) |
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.
-rw-r--r-- | doc/api_assets/style.css | 11 | ||||
-rw-r--r-- | tools/doctool/doctool.js | 3 |
2 files changed, 13 insertions, 1 deletions
diff --git a/doc/api_assets/style.css b/doc/api_assets/style.css index 6dc8718857e..c47f3812b84 100644 --- a/doc/api_assets/style.css +++ b/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; - }
\ No newline at end of file + } diff --git a/tools/doctool/doctool.js b/tools/doctool/doctool.js index 4b4f2f07b7f..da31445fe13 100644 --- a/tools/doctool/doctool.js +++ b/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; |