From e5b99114172100a25b61ffe2eb98d069fe224398 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Tue, 14 Jan 2014 20:06:46 +0000 Subject: [PATCH] Added basic scrollspy --- mkdocs.yaml | 2 +- mkdocs/mkdocs | 4 ++++ theme/base.html | 2 +- theme/js/base.js | 13 +++++++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/mkdocs.yaml b/mkdocs.yaml index ef15b9bd..bcc165ba 100644 --- a/mkdocs.yaml +++ b/mkdocs.yaml @@ -10,7 +10,7 @@ pages: - ['topics/django-extra-views-compatibility.md', 'Topics / Django Extra Views Compatilibity'] - ['topics/release-notes.md', 'Topics / Release Notes'] -theme_dir: 'united' +theme_dir: 'theme' source_dir: 'docs' output_dir: 'build' diff --git a/mkdocs/mkdocs b/mkdocs/mkdocs index 4c9e30b7..0fdcb2cf 100755 --- a/mkdocs/mkdocs +++ b/mkdocs/mkdocs @@ -91,6 +91,10 @@ def build_html(config): content = md.convert(source_content) meta = md.Meta + # Allow 'template:' override in md source files. + if 'template' in meta: + template = env.get_template(meta['template'][0]) + # Strip out the generated table of contents (content, toc) = content.split('', 1) diff --git a/theme/base.html b/theme/base.html index e9a3e795..21ae0af9 100644 --- a/theme/base.html +++ b/theme/base.html @@ -22,7 +22,7 @@ - + {% include "nav.html" %}
diff --git a/theme/js/base.js b/theme/js/base.js index 665394c1..2fe84551 100644 --- a/theme/js/base.js +++ b/theme/js/base.js @@ -1,3 +1,16 @@ +/* Prettyify */ +$( document ).ready(function() { + prettyPrint(); +}); + +/* Scrollspy */ +var navHeight = $('.navbar').outerHeight(true) + 10 + +$('body').scrollspy({ + target: '.bs-sidebar', + offset: navHeight +}) + /* We need to adjust the scroll height of anchor links to adjust for the fixed height navbar */ window.disableShift = false;