Skip to content

Commit

Permalink
Add originak MkDocs port of the Read The Docs theme.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosperate committed Oct 20, 2019
1 parent 541858b commit dddce9f
Show file tree
Hide file tree
Showing 50 changed files with 3,174 additions and 1 deletion.
26 changes: 26 additions & 0 deletions LICENSE-mkdocs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Copyright © 2014, Tom Christie. All rights reserved.

Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the following
conditions are met:

Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ Port of the Read the Docs theme to Jekyll to use with GitHub Pages.
```
vagrant up
vagrant ssh
(in ssh session) > cd /vagrant && bundle exec jekyll serve --host 0.0.0.0
(in ssh session) > cd /vagrant && bundle exec jekyll serve --host 0.0.0.0 --watch --force_polling
```

This is still a **Work-In-Progress** theme and things will **not** work well.

This theme is ported from the MkDocs port of the Read The Docs Sphinx theme.
License and copyright for the theme can be found in the
[LICENSE-mkdocs](LICENSE-mkdocs) file.

-----

Welcome to your new Jekyll theme! In this directory, you'll find the files you need to be able to package up your theme into a gem. Put your layouts in `_layouts`, your includes in `_includes`, your sass files in `_sass` and any other assets in `assets`.
Expand Down
41 changes: 41 additions & 0 deletions _includes/breadcrumbs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="{{ nav.homepage.url|url }}">Docs</a> &raquo;</li>
{% if page %}
{% for doc in page.ancestors %}
{% if doc.link %}
<li><a href="{{ doc.link|e }}">{{ doc.title }}</a> &raquo;</li>
{% else %}
<li>{{ doc.title }} &raquo;</li>
{% endif %}
{% endfor %}
{% endif %}
{% if page %}<li>{{ page.title }}</li>{% endif %}
<li class="wy-breadcrumbs-aside">
{%- block repo %}
{% if page and page.edit_url %}
<a href="{{ page.edit_url }}"
{%- if config.repo_name|lower == 'github' %}
class="icon icon-github"
{%- elif config.repo_name|lower == 'bitbucket' %}
class="icon icon-bitbucket"
{%- elif config.repo_name|lower == 'gitlab' %}
class="icon icon-gitlab"
{% endif %}> Edit on {{ config.repo_name }}</a>
{% endif %}
{%- endblock %}
</li>
</ul>
{% if config.theme.prev_next_buttons_location|lower in ['top', 'both']
and page and (page.next_page or page.previous_page) %}
<div class="rst-breadcrumbs-buttons" role="navigation" aria-label="breadcrumb navigation">
{%- if page.next_page %}
<a href="{{ page.next_page.url|url }}" class="btn btn-neutral float-right" title="{{ page.next_page.title }}">Next <span class="icon icon-circle-arrow-right"></span></a>
{%- endif %}
{%- if page.previous_page %}
<a href="{{ page.previous_page.url|url }}" class="btn btn-neutral" title="{{ page.previous_page.title }}"><span class="icon icon-circle-arrow-left"></span> Previous</a>
{%- endif %}
</div>
{% endif %}
<hr/>
</div>
26 changes: 26 additions & 0 deletions _includes/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<footer>
{%- block next_prev %}
{% if config.theme.prev_next_buttons_location|lower in ['bottom', 'both']
and page and (page.next_page or page.previous_page) %}
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
{% if page.next_page %}
<a href="{{ page.next_page.url|url }}" class="btn btn-neutral float-right" title="{{ page.next_page.title }}">Next <span class="icon icon-circle-arrow-right"></span></a>
{% endif %}
{% if page.previous_page %}
<a href="{{ page.previous_page.url|url }}" class="btn btn-neutral" title="{{ page.previous_page.title }}"><span class="icon icon-circle-arrow-left"></span> Previous</a>
{% endif %}
</div>
{% endif %}
{%- endblock %}

<hr/>

<div role="contentinfo">
<!-- Copyright etc -->
{% if config.copyright %}
<p>{{ config.copyright }}</p>
{% endif %}
</div>

Built with <a href="https://www.mkdocs.org/">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
22 changes: 22 additions & 0 deletions _includes/nav.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<a class="{% if not nav_item.is_link %}reference internal{% endif %}{% if nav_item.active%} current{%endif%}" href="{% if not nav_item.is_section %}{{ nav_item.url|url }}{% else %}#{% endif %}">{{ nav_item.title }}</a>
{%- set navlevel = navlevel + 1 %}
{%- if navlevel <= config.theme.navigation_depth
and ((nav_item.is_page and nav_item.toc.items
and (not config.theme.titles_only
and (nav_item == page or not config.theme.collapse_navigation)))
or (nav_item.is_section and nav_item.children)) %}
<ul{% if nav_item.active %} class="current"{% endif %}>
{%- if nav_item.is_page %}
{#- Skip first level of toc which is page title. #}
{%- set toc_item = nav_item.toc.items[0] %}
{%- include 'toc.html' %}
{%- elif nav_item.is_section %}
{%- for nav_item in nav_item.children %}
<li class="toctree-l{{ navlevel }}{% if nav_item.active%} current{%endif%}">
{%- include 'nav.html' %}
</li>
{%- endfor %}
{%- endif %}
</ul>
{%- endif %}
{%- set navlevel = navlevel - 1 %}
5 changes: 5 additions & 0 deletions _includes/searchbox.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div role="search">
<form id ="rtd-search-form" class="wy-form" action="{{ base_url }}/search.html" method="get">
<input type="text" name="q" placeholder="Search docs" title="Type search term here" />
</form>
</div>
12 changes: 12 additions & 0 deletions _includes/toc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

{%- for toc_item in toc_item.children %}
<li class="toctree-l{{ navlevel}}"><a class="reference internal" href="{% if not nav_item == page %}{{ nav_item.url|url }}{% endif %}{{ toc_item.url }}">{{ toc_item.title }}</a>
{%- set navlevel = navlevel + 1 %}
{%- if navlevel <= config.theme.navigation_depth and toc_item.children %}
<ul>
{%- include 'toc.html' %}
</ul>
{%- endif %}
{%- set navlevel = navlevel - 1 %}
</li>
{%- endfor %}
17 changes: 17 additions & 0 deletions _includes/versions.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<div class="rst-versions" role="note" aria-label="versions">
<span class="rst-current-version" data-toggle="rst-current-version">
{% if config.repo_name == 'GitHub' %}
<a href="{{ config.repo_url }}" class="fa fa-github" style="float: left; color: #fcfcfc"> GitHub</a>
{% elif config.repo_name == 'Bitbucket' %}
<a href="{{ config.repo_url }}" class="icon icon-bitbucket" style="float: left; color: #fcfcfc"> BitBucket</a>
{% elif config.repo_name == 'GitLab' %}
<a href="{{ config.repo_url }}" class="icon icon-gitlab" style="float: left; color: #fcfcfc"> GitLab</a>
{% endif %}
{% if page.previous_page %}
<span><a href="{{ page.previous_page.url|url }}" style="color: #fcfcfc;">&laquo; Previous</a></span>
{% endif %}
{% if page.next_page %}
<span style="margin-left: 15px"><a href="{{ page.next_page.url|url }}" style="color: #fcfcfc">Next &raquo;</a></span>
{% endif %}
</span>
</div>
9 changes: 9 additions & 0 deletions _layouts/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% extends "base.html" %}

{% block content %}

<h1 id="404-page-not-found">404</h1>

<p><strong>Page not found</strong></p>

{% endblock %}
163 changes: 163 additions & 0 deletions _layouts/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
{%- block site_meta %}
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% if page and page.is_homepage %}<meta name="description" content="{{ config.site_description }}">{% endif %}
{% if config.site_author %}<meta name="author" content="{{ config.site_author }}">{% endif %}
{% if page and page.canonical_url %}<link rel="canonical" href="{{ page.canonical_url }}">{% endif %}
{% if config.site_favicon %}<link rel="shortcut icon" href="{{ config.site_favicon|url }}">
{% else %}<link rel="shortcut icon" href="{{ 'img/favicon.ico'|url }}">{% endif %}
{%- endblock %}

{%- block htmltitle %}
<title>{% if page and page.title and not page.is_homepage %}{{ page.title }} - {% endif %}{{ config.site_name }}</title>
{%- endblock %}

{%- block styles %}
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700" />

<link rel="stylesheet" href="{{ 'css/theme.css'|url }}" />
<link rel="stylesheet" href="{{ 'css/theme_extra.css'|url }}" />
{%- if config.theme.highlightjs %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css" />
{%- endif %}
{%- for path in config['extra_css'] %}
<link href="{{ path|url }}" rel="stylesheet" />
{%- endfor %}
{%- endblock %}

{%- block libs %}
{% if page %}
<script>
// Current page data
var mkdocs_page_name = {{ page.title|tojson|safe }};
var mkdocs_page_input_path = {{ page.file.src_path|string|tojson|safe }};
var mkdocs_page_url = {{ page.abs_url|tojson|safe }};
</script>
{% endif %}
<script src="{{ 'js/jquery-2.1.1.min.js'|url }}" defer></script>
<script src="{{ 'js/modernizr-2.8.3.min.js'|url }}" defer></script>
{%- if config.theme.highlightjs %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
{%- for lang in config.theme.hljs_languages %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/languages/{{lang}}.min.js"></script>
{%- endfor %}
<script>hljs.initHighlightingOnLoad();</script>
{%- endif %}
{%- endblock %}

{%- block extrahead %} {% endblock %}

{%- block analytics %}
{% if config.google_analytics %}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', '{{ config.google_analytics[0] }}', '{{ config.google_analytics[1] }}');
ga('send', 'pageview');
</script>
{% endif %}
{%- endblock %}
</head>

<body class="wy-body-for-nav" role="document">

<div class="wy-grid-for-nav">

{# SIDE NAV, TOGGLES ON MOBILE #}
<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
{%- block site_name %}
<a href="{{ nav.homepage.url|url }}" class="icon icon-home"> {{ config.site_name }}</a>
{%- endblock %}
{%- block search_button %}
{% if 'search' in config['plugins'] %}{% include "searchbox.html" %}{% endif %}
{%- endblock %}
</div>

<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
{%- block site_nav %}
{%- set navlevel = 1 %}
{%- for nav_item in nav %}
{%- if nav_item.is_section %}
<p class="caption"><span class="caption-text">{{ nav_item.title }}</span></p>
<ul{% if nav_item.active %} class="current"{% endif %}>
{%- for nav_item in nav_item.children %}
<li class="toctree-l{{ navlevel }}{% if nav_item.active %} current{% endif %}">
{%- include 'nav.html' %}
</li>
{%- endfor %}
</ul>
{%- elif config.theme.include_homepage_in_sidebar or (not nav_item == nav.homepage) %}
<ul{% if nav_item.active %} class="current"{% endif %}>
<li class="toctree-l{{ navlevel }}{% if nav_item.active %} current{% endif %}">
{%- include 'nav.html' %}
</li>
</ul>
{%- endif %}
{%- endfor %}
{%- endblock %}
</div>
</div>
</nav>

<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

{# MOBILE NAV, TRIGGLES SIDE NAV ON TOGGLE #}
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="{{ nav.homepage.url|url }}">{{ config.site_name }}</a>
</nav>

{# PAGE CONTENT #}
<div class="wy-nav-content">
<div class="rst-content">
{% include "breadcrumbs.html" %}
<div role="main">
<div class="section">
{% block content %}
{{ page.content }}
{% endblock %}
</div>
</div>
{%- block footer %}
{% include "footer.html" %}
{% endblock %}
</div>
</div>

</section>

</div>

{% include "versions.html" %}

{%- block scripts %}
<script>var base_url = '{{ base_url }}';</script>
<script src="{{ 'js/theme.js'|url }}" defer></script>
{%- for path in config['extra_javascript'] %}
<script src="{{ path|url }}" defer></script>
{%- endfor %}
<script type="text/javascript" defer>
window.onload = function () {
SphinxRtdTheme.Navigation.enable({{ 'true' if config.theme.sticky_navigation else 'false' }});
};
</script>
{%- endblock %}

</body>
</html>
{% if page and page.is_homepage %}
<!--
MkDocs version : {{ mkdocs_version }}
Build Date UTC : {{ build_date_utc }}
-->
{% endif %}
3 changes: 3 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
---
layout: base
---
{{ content }}
10 changes: 10 additions & 0 deletions _layouts/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% extends "base.html" %}

{#
The entry point for the ReadTheDocs Theme.

Any theme customisations should override this file to redefine blocks defined in
the various templates. The custom theme should only need to define a main.html
which `{% extends "base.html" %}` and defines various blocks which will replace
the blocks defined in base.html and its included child templates.
#}
16 changes: 16 additions & 0 deletions _layouts/search.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{% extends "base.html" %}

{% block content %}

<h1 id="search">Search Results</h1>

<form id="content_search" action="search.html">
<span role="status" aria-live="polite" class="ui-helper-hidden-accessible"></span>
<input name="q" id="mkdocs-search-query" type="text" class="search_input search-query ui-autocomplete-input" placeholder="Search the Docs" autocomplete="off" autofocus title="Type search term here">
</form>

<div id="mkdocs-search-results" class="search-results">
Searching...
</div>

{% endblock %}
Loading

0 comments on commit dddce9f

Please sign in to comment.