From 8d3145ff3b76739827474fcd6c7727b9a10fc20b Mon Sep 17 00:00:00 2001 From: Misty Stanley-Jones Date: Mon, 30 Jan 2017 15:34:25 -0800 Subject: [PATCH 1/2] Add an automatic TOC to pages that don't have no_toc in front-matter --- _config.yml | 3 + _includes/toc_pure_liquid.html | 70 ++++++++++++ _layouts/docs.html | 36 ++++--- css/documentation.css | 100 ++++++++++-------- .../installation/linux/linux-postinstall.md | 7 +- index.md | 1 + js/menu.js | 48 --------- 7 files changed, 150 insertions(+), 115 deletions(-) create mode 100644 _includes/toc_pure_liquid.html diff --git a/_config.yml b/_config.yml index 74a67ed6a6..3b5c44841c 100644 --- a/_config.yml +++ b/_config.yml @@ -5,6 +5,7 @@ kramdown: html_to_native: true hard_wrap: false syntax_highlighter: rouge + toc_levels: 2..3 incremental: true permalink: pretty safe: false @@ -29,6 +30,8 @@ defaults: layout: docs defaultassignee: johndmulhausen enginebranch: 1.13.x + toc_min: 2 + toc_max: 3 - scope: path: "compose" values: diff --git a/_includes/toc_pure_liquid.html b/_includes/toc_pure_liquid.html new file mode 100644 index 0000000000..bf2b4c166d --- /dev/null +++ b/_includes/toc_pure_liquid.html @@ -0,0 +1,70 @@ +{% capture tocWorkspace %} + {% comment %} + "...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe + Usage: + {% include toc_pure_liquid.html html=content sanitize=true class="inline_toc" id="my_toc" toc_min=2 toc_max=3 my_name="unnamed" %} + + Variables: + * html (string) - the HTML of compiled markdown generated by kramdown in Jekyll + * sanitize (bool) - when set to true, the headers will be sanitized in the TOC + * class (string) - a CSS class assigned to the TOC + * id (string) - an ID to assigned to the TOC + * toc_min (int) - the minimum TOC header level to use (if not set, check page, then site, then default to 2) + * toc_max (int) - the maximum TOC header level to use (if not set, check page, then site, then default to 3) + * page_name (string) - the URL of the page + + Output: + An unordered list representing the table of contents of a markdown block. This snippet will only generate the table of contents and will NOT output the markdown given to it + {% endcomment %} + + {% capture my_toc %}{% endcapture %} + {% assign minHeader = include.toc_min | default: 2 %} + {% assign maxHeader = include.toc_max | default: 3 %} + {% assign my_name = include.page_name | default: "unnamed" %} + {% assign nodes = include.html | split: '= minHeader %} + {% continue %} + {% endunless %} + + {% if headerLevel > maxHeader %} + {% continue %} + {% endif %} + + {% assign _idWorkspace = _workspace[0] | split: '"' %} + {% assign html_id = _idWorkspace[1] %} + + {% capture _hAttrToStrip %}{{ headerLevel }} id="{{ html_id }}">{% endcapture %} + {% assign header = _workspace[0] | replace: _hAttrToStrip, '' %} + + {% assign space = '' %} + {% for i in (1..indentAmount) %} + {% assign space = space | prepend: ' ' %} + {% endfor %} + + {% capture my_toc %}{{ my_toc }} +{{ space }}- [{% if include.sanitize %}{{ header | strip_html }}{% else %}{{ header }}{% endif %}]({{ my_name }}#{{ html_id }}){: class="nomunge" }{% endcapture %} + + {% endfor %} + + {% if include.class %} + {% capture my_toc %}{:.{{ include.class }}} +{{ my_toc | lstrip }}{% endcapture %} + {% endif %} + + {% if include.id %} + {% capture my_toc %}{: #{{ include.id }}} +{{ my_toc | lstrip }}{% endcapture %} + {% endif %} +{% endcapture %}{% assign tocWorkspace = '' %} +{{ my_toc | markdownify }} diff --git a/_layouts/docs.html b/_layouts/docs.html index a2b7a420d0..c02685a0e4 100644 --- a/_layouts/docs.html +++ b/_layouts/docs.html @@ -201,12 +201,12 @@ ng\:form { -
+
{% if page.title %}

{{ page.title }}

{% endif %} {% if page.advisory %}
{{ site.data.advisories.texts[page.advisory] | markdownify }}
{% endif %} {% include read_time.html %} - {{ content }} + {{ content }} {% if page.noratings != true %}
chat icon @@ -252,26 +252,34 @@ ng\:form { }
- {% if page.notoc != true %} -
diff --git a/css/documentation.css b/css/documentation.css index 0df6a8630e..f1ca1a3ba9 100644 --- a/css/documentation.css +++ b/css/documentation.css @@ -131,9 +131,10 @@ color: black; } #DocumentationText a, -#TableOfContentsSection a { +#RightColumnSection a { color: #008AB5; } + /* reset away from #008AB5 */ /* removed hard-coded color for button links pre new CSS from Design */ @@ -303,7 +304,7 @@ div.docsidebarnav_section.affix ul { } /* TableOfContents */ -.tableofcontents_section { +.right_column_section { padding: 0; } .rating-msg { @@ -316,55 +317,15 @@ div.docsidebarnav_section.affix ul { display: none !important; } -#TableOfContents { - padding-top: 10px; -} -#TableOfContentsSection { - margin: 0; +#RightColumnSection { padding: 0 !important; - background-color: #f5fdff; } -#TableOfContents li a, -#TableOfContentsSection .heading { - font-size: 14px; - font-style: normal; - margin: 0; - padding: 10px 15px; - display: block !important; - line-height: 15px; -} -#TableOfContentsSection .heading { - background-color: #6db9d1; - color: #ffffff; -} -#TableOfContentsSection ​#TableOfContents { - background-color: #F5FDFF; - margin: 0; - padding: 15px; -} -#TableOfContentsSection #TableOfContents ul { - list-style: none; - padding: 0; - left: 0; - padding: 0; - width: 100%; - text-align: left; - overflow: hidden; - margin-left: 0; - padding-left: 0.30rem; - font-size: 14px; -} - -#TableOfContentsSection #TableOfContents > ul { - padding-left: 0; +#RightColumnSection ul { + padding-top: 5px; list-style: none; + margin-left: 0; } - -#TableOfContentsSection #TableOfContents > ul > li > ul { - padding-left: 0; -} - .advisory { color: #F04124; margin: -20px -20px 20px -20px; @@ -388,7 +349,6 @@ color: #F04124; } .search-form .algolia-autocomplete .search-field, #st-search-input { width: 100%; - border: 1px solid lightgray; } .search-form{ max-width: 420px; @@ -451,3 +411,49 @@ span.reading-time-label { img.with-border { border: 1px solid #eaeaea; } + +#search-div { + margin-top: 10px; + border: 1px solid #2294ca; +} + +#side-toc { + background-color: #f5fdff; + border: 1px solid #2294ca; + padding: 10px; + margin-top: 20px; + width: 100%; +} + +#feedback-links { + border: 1px solid #2294ca; + padding: 10px; + margin-top: 20px; + width: 100%; +} + +#side-toc-contents, +#feedback-links { + list-style-type: none; + font-size: 80%; +} + +#side-toc-contents ul, +#feedback-links ul { + margin-bottom: 0; +} + +#side-toc-contents li { + padding-bottom: 7px; + padding-top: 7px; + line-height: 1!important; +} +#side-toc-contents ul ul li { + padding-left: 14px; +} +#side-toc-title { + font-weight: bolder; + font-size: 90%; + color: #155A74; + padding-bottom: 5px; +} diff --git a/engine/installation/linux/linux-postinstall.md b/engine/installation/linux/linux-postinstall.md index 0e36fec795..cad4e827ad 100644 --- a/engine/installation/linux/linux-postinstall.md +++ b/engine/installation/linux/linux-postinstall.md @@ -8,11 +8,6 @@ title: Post-installation steps for Linux This section contains optional procedures for configuring Linux hosts to work better with Docker. -* [Manage Docker as a non-root user](#manage-docker-as-a-non-root-user) -* [Configure Docker to start on boot](#configure-docker-to-start-on-boot) -* [Allow access to the remote API through a firewall](#allow-access-to-the-remote-api-through-a-firewall) -* [Troubleshooting](#troubleshooting) - ## Manage Docker as a non-root user The `docker` daemon binds to a Unix socket instead of a TCP port. By default @@ -213,7 +208,7 @@ at `/etc/docker/daemon.json`. 2. Add a `dns` key with one or more IP addresses as values. If the file has existing contents, you only need to add or edit the `dns` line. - + ```json { "dns": ["8.8.8.8", "8.8.4.4"] diff --git a/index.md b/index.md index 92ab031c02..24fb645b6e 100644 --- a/index.md +++ b/index.md @@ -3,6 +3,7 @@ description: Home page for Docker's documentation keywords: Docker, documentation, manual, guide, reference, api layout: docs title: Docker Documentation +notoc: true --- Docker packages your app with its dependencies, freeing you from worrying about your diff --git a/js/menu.js b/js/menu.js index 9f83c1e3fc..337bc2f105 100644 --- a/js/menu.js +++ b/js/menu.js @@ -199,52 +199,4 @@ jQuery(document).ready(function(){ metadata = data; hookupTOCEvents(); }); - $("#TableOfContents ul").empty(); - - var prevH2Item = null; - var prevH2List = null; - - var index = 0; - var currentHeader = 0, lastHeader = 0; - var output = ""; - $("#TableOfContents").html(output); }); From eb3c38fda58d1dab033de97cbf455b068d9febc5 Mon Sep 17 00:00:00 2001 From: Misty Stanley-Jones Date: Tue, 31 Jan 2017 13:19:49 -0800 Subject: [PATCH 2/2] Remove manual TOC from D4M and D4W release notes --- docker-for-mac/release-notes.md | 3 --- docker-for-windows/release-notes.md | 4 ---- 2 files changed, 7 deletions(-) diff --git a/docker-for-mac/release-notes.md b/docker-for-mac/release-notes.md index b92b64e9f6..fbc9021273 100644 --- a/docker-for-mac/release-notes.md +++ b/docker-for-mac/release-notes.md @@ -16,9 +16,6 @@ Release notes for _stable_ and _beta_ releases are listed below. You can learn about both kinds of releases, and download stable and beta product installers at [Download Docker for Mac](index.md#download-docker-for-mac). -* [Stable Release Notes](release-notes.md#stable-release-notes) -* [Beta Release Notes](release-notes.md#beta-release-notes) - ## Stable Release Notes ### Docker for Mac 1.13.0, 2017-01-19 (stable) diff --git a/docker-for-windows/release-notes.md b/docker-for-windows/release-notes.md index 51c838dc1d..11a66e8920 100644 --- a/docker-for-windows/release-notes.md +++ b/docker-for-windows/release-notes.md @@ -16,10 +16,6 @@ Release notes for _stable_ and _beta_ releases are listed below. You can learn about both kinds of releases, and download stable and beta product installers at [Download Docker for Windows](index.md#download-docker-for-windows). -* [Stable Release Notes](release-notes.md#stable-release-notes) -* [Beta Release Notes](release-notes.md#beta-release-notes) -* [Alpha Release Notes](release-notes.md#alpha-release-notes) - ## Stable Release Notes ### Docker for Windows 1.13.0, 2017-01-19 (stable)