Skip to content

Commit

Permalink
added sidebar toggle menu
Browse files Browse the repository at this point in the history
  • Loading branch information
wookay committed Mar 17, 2017
1 parent fec8ac0 commit d4d49a8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
21 changes: 19 additions & 2 deletions assets/html/documenter.css
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ nav.toc {
box-shadow: inset -14px 0px 5px -12px rgb(210,210,210);
}

nav.toc.off {
display: none;
}

nav.toc .logo {
margin: 0 auto;
display: block;
Expand Down Expand Up @@ -258,15 +262,24 @@ article > header nav li {
padding-right: 0.2em;
}

article > header nav li:before {
article > header nav ul.float-left li:before {
content: "»";
padding-right: 0.2em;
}

article > header .edit-page {
article > header nav ul.float-right {
float: right;
}

article > header nav ul.float-right a.btn {
display: none;
}

article > header nav ul.float-right i.fa-bars {
text-align: center;
width: 3em;
}

article > footer {}

article > footer a.prev {
Expand Down Expand Up @@ -410,4 +423,8 @@ article section.docstring a.source-link {
article {
margin-left: 0em;
}

article ul.float-right a.btn {
display: block !important;
}
}
7 changes: 7 additions & 0 deletions assets/html/documenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ require(['jquery', 'highlight', 'highlight-julia'], function($, hljs) {
});
}
hljs.initHighlighting();

if ($("nav.toc").css('position') == 'relative') {
$("nav.toc").toggleClass('off')
}
$("article ul.float-right a.btn").click(function() {
$("nav.toc").toggleClass('off')
});
})

})
10 changes: 6 additions & 4 deletions src/Writers/HTMLWriter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -360,18 +360,20 @@ end
# ------------------------------------------------------------------------------

function render_article(ctx, navnode)
@tags article header footer nav ul li hr span a
@tags article header footer nav ul li hr span a i

header_links = map(Documents.navpath(navnode)) do nn
title = mdconvert(pagetitle(ctx, nn))
isnull(nn.page) ? li(title) : li(a[:href => navhref(nn, navnode)](title))
end

topnav = nav(ul(header_links))
topnavleft = ul[".float-left"](header_links)
topnavright = ul[".float-right"]
Utilities.unwrap(Utilities.url(ctx.doc.user.repo, getpage(ctx, navnode).source)) do url
push!(topnav.nodes, a[".edit-page", :href => url](span[".fa"]("\uf09b"), " Edit on GitHub"))
push!(topnavright.nodes, li(a[".edit-page", :href => url](span[".fa"]("\uf09b"), " Edit on GitHub")))
end
art_header = header(topnav, hr())
push!(topnavright.nodes, li(a[".btn", :href => "#"](i[".fa .fa-bars", Symbol("aria-hidden") => "true"])))
art_header = header(nav(topnavleft, topnavright), hr())

# build the footer with nav links
art_footer = footer(hr())
Expand Down

0 comments on commit d4d49a8

Please sign in to comment.