portico: Add anchor link support to API and user docs.

Fixes #7432.
This commit is contained in:
Cynthia Lin
2017-11-12 16:46:19 -08:00
parent 9d973129ab
commit aa50fae4ba
2 changed files with 32 additions and 5 deletions

View File

@@ -81,6 +81,17 @@ function render_code_sections() {
e.preventDefault();
});
// Show Guides user docs in sidebar by default
$('.help .sidebar h2#guides + ul').css('display', 'block');
// Remove ID attributes from sidebar links so they don't conflict with index page anchor links
$('.help .sidebar h1, .help .sidebar h2, .help .sidebar h3').removeAttr('id');
// Scroll to anchor link when clicked
$('.markdown .content h1, .markdown .content h2, .markdown .content h3').on('click', function () {
window.location.href = window.location.href.replace(/#.*/, '') + '#' + $(this).attr("id");
});
Ps.initialize($(".markdown")[0], {
suppressScrollX: true,
useKeyboard: false,

View File

@@ -218,11 +218,6 @@ body {
display: block;
}
/* show two of them by default */
.help .sidebar #guides + ul {
display: block;
}
.app.help .hamburger {
display: none;
}
@@ -1507,6 +1502,27 @@ input.new-organization-button {
font-weight: 700;
}
.markdown h1:hover,
.markdown h2:hover,
.markdown h3:hover {
cursor: pointer;
}
.markdown h1:hover:after,
.markdown h2:hover:after,
.markdown h3:hover:after {
display: inline-block;
font: normal normal normal 16px/1 FontAwesome;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
cursor: pointer;
content: "\f0c1";
margin-left: 5px;
vertical-align: middle;
}
.markdown h1,
.why-page .main h1 {
border-bottom: 1px solid #eee;