diff --git a/README.md b/README.md index badaa5cd15d70a57c952705b8c745a327b9c1d4f..12377072ddb6e561cf084bfd720d4c22e4aca623 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ <br><br> <p align="center"> <h1 align="center">Just the Docs</h1> - <p align="center">A modern, high customizable, responsive Jekyll theme for documentation with built-in search.<br>Easily hosted on GitHub Pages with few dependencies.</p> + <p align="center">A modern, highly customizable, and responsive Jekyll theme for documentation with built-in search.<br>Easily hosted on GitHub Pages with few dependencies.</p> <p align="center"><strong><a href="https://pmarsceill.github.io/just-the-docs/">See it in action!</a></strong></p> <br><br><br> </p> diff --git a/_config.yml b/_config.yml index d12d4396fc5618f4066b678e42aff98d66f235a8..a09067082833b73ec56343a3d45170ce95c9c2af 100644 --- a/_config.yml +++ b/_config.yml @@ -21,9 +21,15 @@ url: "https://pmarsceill.github.io" # the base hostname & protocol for your site permalink: pretty exclude: ["node_modules/", "*.gemspec", "*.gem", "Gemfile", "Gemfile.lock", "package.json", "package-lock.json", "script/", "LICENSE.txt", "lib/", "bin/", "README.md", "Rakefile"] +# Set a path/url to a logo that will be displayed instead of the title +#logo: "/assets/images/just-the-docs.png" + # Enable or disable the site search search_enabled: true +# Set the search token separator for hyphenated-word search: +search_tokenizer_separator: /[\s/]+/ + # Enable or disable heading anchors heading_anchors: true @@ -50,5 +56,5 @@ compress_html: comments: all endings: all startings: [] - blank_lines: false + blanklines: false profile: false diff --git a/_includes/title.html b/_includes/title.html index f6d566937aa74477f4d6ea6409fce0e039ce3d33..8bd3fa83dada15bedce25228bb166f451c97cd79 100644 --- a/_includes/title.html +++ b/_includes/title.html @@ -1 +1,5 @@ -{{ site.title }} \ No newline at end of file +{% if site.logo %} + <div class="site-logo"></div> +{% else %} + {{ site.title }} +{% endif %} diff --git a/_layouts/default.html b/_layouts/default.html index 2eba7605613149668f81e7d0d23410931af723e6..abe9929a4fbc49d328a202367e8196775a2c59a3 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -8,6 +8,10 @@ layout: table_wrappers {% include head.html %} <body> <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> + <symbol id="link" viewBox="0 0 16 16"> + <title>Link</title> + <path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path> + </symbol> <symbol id="arrow-right" viewBox="0 0 24 24"> <title>Expand</title> <path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/><path d="M0 0h24v24H0z" fill="none"/> @@ -67,7 +71,7 @@ layout: table_wrappers {% endunless %} <div id="main-content" class="main-content" role="main"> {% if site.heading_anchors != false %} - {% include vendor/anchor_headings.html html=content beforeHeading = "true" anchorBody="<svg class=\"d-inline-block v-align-middle\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"18\" height=\"18\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg>" anchorClass="anchor-heading" %} + {% include vendor/anchor_headings.html html=content beforeHeading="true" anchorBody="<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><use xlink:href=\"#link\"></use></svg>" anchorClass="anchor-heading" %} {% else %} {{ content }} {% endif %} @@ -80,7 +84,7 @@ layout: table_wrappers {% for child in children_list %} {% if child.parent == page.title and child.title != page.title %} <li> - <a href="{{ child.url | absolute_url }}">{{ child.title }}</a> + <a href="{{ child.url | absolute_url }}">{{ child.title }}</a>{% if child.summary %} - {{ child.summary }}{% endif %} </li> {% endif %} {% endfor %} diff --git a/_sass/base.scss b/_sass/base.scss index 1ea39036ee6f137a0537fb492c3405601a653121..126f608bced636b24f74fc81b15946b96ee07cc1 100644 --- a/_sass/base.scss +++ b/_sass/base.scss @@ -88,7 +88,8 @@ code { line-height: $body-line-height; } -figure { +figure, +pre { margin: 0; } diff --git a/_sass/content.scss b/_sass/content.scss index f771939f84a51d4e9d5400f2b9056ede8e8fcee1..1580a433f741da32209d65a753229f6b1c96b0ba 100644 --- a/_sass/content.scss +++ b/_sass/content.scss @@ -116,26 +116,37 @@ .anchor-heading { position: absolute; - right: -$sp-3; + right: -$sp-4; width: $sp-5; height: 100%; + padding-right: $sp-1; + padding-left: $sp-1; overflow: visible; - fill: $link-color; - visibility: hidden; @include mq(md) { right: auto; left: -$sp-5; } + + svg { + display: inline-block; + width: 100%; + height: 100%; + fill: $link-color; + visibility: hidden; + } } + .anchor-heading:hover, h1:hover > .anchor-heading, h2:hover > .anchor-heading, h3:hover > .anchor-heading, h4:hover > .anchor-heading, h5:hover > .anchor-heading, h6:hover > .anchor-heading { - visibility: visible; + svg { + visibility: visible; + } } h1, diff --git a/_sass/layout.scss b/_sass/layout.scss index 12b7fe0c33a365aa58f663225afdf0ea0f5699a8..4f9e3650c01a4d27a72f813a0ec396cf1e2a2cd8 100644 --- a/_sass/layout.scss +++ b/_sass/layout.scss @@ -123,12 +123,12 @@ .site-header { display: flex; + min-height: $header-height; align-items: center; @include mq(md) { z-index: 101; height: $header-height; - min-height: $header-height; max-height: $header-height; border-bottom: $border $border-color; } @@ -140,10 +140,26 @@ display: flex; height: 100%; align-items: center; - padding-top: $gutter-spacing-sm; - padding-bottom: $gutter-spacing-sm; + padding-top: $sp-3; + padding-bottom: $sp-3; color: $body-heading-color; @include fs-6; + + @include mq(md) { + padding-top: $sp-2; + padding-bottom: $sp-2; + } +} + +@if variable-exists(logo) { + .site-logo { + width: 100%; + height: 100%; + background-image: url($logo); + background-repeat: no-repeat; + background-position: left center; + background-size: contain; + } } .site-button { diff --git a/_sass/overrides.scss b/_sass/overrides.scss new file mode 100644 index 0000000000000000000000000000000000000000..21e9527d20b4b72ccec57bde40b1217a645420b8 --- /dev/null +++ b/_sass/overrides.scss @@ -0,0 +1,3 @@ +// +// Custom overrides from a user. +// diff --git a/_sass/utilities/_lists.scss b/_sass/utilities/_lists.scss index 3c76dcf63885235e792ba5879b58fa536dc6ba2f..c7b2293d0f92cdc4fe8b1d8565fed6b1a2c6a779 100644 --- a/_sass/utilities/_lists.scss +++ b/_sass/utilities/_lists.scss @@ -2,10 +2,16 @@ // Utility classes for lists // -// stylelint-disable primer/selector-no-utility, primer/no-override +// stylelint-disable primer/selector-no-utility, primer/no-override, selector-max-type .list-style-none { padding: 0 !important; margin: 0 !important; list-style: none !important; + + li { + &::before { + display: none !important; + } + } } diff --git a/assets/css/dark-mode-preview.scss b/assets/css/dark-mode-preview.scss index 8b77da6a86422fb0fea410952175c34f65525478..c524e81286d4c220a73882b5f4dd6978714d2d8e 100644 --- a/assets/css/dark-mode-preview.scss +++ b/assets/css/dark-mode-preview.scss @@ -3,6 +3,10 @@ # only Main files contain this front matter, not partials. --- +{% if site.logo %} +$logo: "{{ site.logo | absolute_url }}"; +{% endif %} + // // Import external dependencies // diff --git a/assets/css/just-the-docs.scss b/assets/css/just-the-docs.scss index 6a2eefa5ca319368e85410163b74139dacb98eb0..199ad89ca35b896e91c96c8db41639ef28553355 100644 --- a/assets/css/just-the-docs.scss +++ b/assets/css/just-the-docs.scss @@ -3,6 +3,10 @@ # only Main files contain this front matter, not partials. --- +{% if site.logo %} +$logo: "{{ site.logo | absolute_url }}"; +{% endif %} + // // Import external dependencies // @@ -42,3 +46,4 @@ @import "./tables"; @import "./code"; @import "./utilities/utilities"; +@import "./overrides"; diff --git a/assets/js/dark-mode-preview.js b/assets/js/dark-mode-preview.js new file mode 100644 index 0000000000000000000000000000000000000000..b9ad81ef4cd610ce326f49decbea56909f8b3a93 --- /dev/null +++ b/assets/js/dark-mode-preview.js @@ -0,0 +1,23 @@ +document.addEventListener("DOMContentLoaded", function(){ + + const toggleDarkMode = document.querySelector('.js-toggle-dark-mode') + const cssFile = document.querySelector('[rel="stylesheet"]') + const originalCssRef = cssFile.getAttribute('href') + const darkModeCssRef = originalCssRef.replace('just-the-docs.css', 'dark-mode-preview.css') + const buttonCopy = ['Return to the light side', 'Preview dark color scheme'] + const updateButtonText = function(toggleDarkMode) { + toggleDarkMode.textContent === buttonCopy[0] ? + toggleDarkMode.textContent = buttonCopy[1] : + toggleDarkMode.textContent = buttonCopy[0] + } + + jtd.addEvent(toggleDarkMode, 'click', function(){ + if (cssFile.getAttribute('href') === originalCssRef) { + cssFile.setAttribute('href', darkModeCssRef) + updateButtonText(toggleDarkMode) + } else { + cssFile.setAttribute('href', originalCssRef) + updateButtonText(toggleDarkMode) + } + }) +}) diff --git a/assets/js/just-the-docs.js b/assets/js/just-the-docs.js index 0ba8dc96eab1836e4c92c7ce3c4792c4d621c58c..316985ef48eba54bfc4c1b1d77372f57de1231b9 100644 --- a/assets/js/just-the-docs.js +++ b/assets/js/just-the-docs.js @@ -63,8 +63,13 @@ function initSearch() { if (request.status >= 200 && request.status < 400) { // Success! var data = JSON.parse(request.responseText); - + + {% if site.search_tokenizer_separator != nil %} + lunr.tokenizer.separator = {{ site.search_tokenizer_separator }} + {% else %} lunr.tokenizer.separator = /[\s\-/]+/ + {% endif %} + var index = lunr(function () { this.ref('id'); this.field('title', { boost: 200 }); diff --git a/assets/js/search-data.json b/assets/js/search-data.json index 6f728cda154c8940884e25104dcecdd3955e6fd2..0532f7c6b72d2c25a3767ff2c119bb5841d38b75 100644 --- a/assets/js/search-data.json +++ b/assets/js/search-data.json @@ -1,11 +1,12 @@ --- --- { - {% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": { + {% assign comma = false %} + {% for page in site.html_pages %}{% if page.search_exclude != true %}{% if comma == true%},{% endif %}"{{ forloop.index0 }}": { "title": "{{ page.title | replace: '&', '&' }}", "content": "{{ page.content | markdownify | replace: '</h', ' . </h' | replace: '<hr', ' . <hr' | replace: '</p', ' . </p' | replace: '</ul', ' . </ul' | replace: '</tr', ' . </tr' | replace: '</li', ' | </li' | replace: '</td', ' | </td' | strip_html | escape_once | remove: 'Table of contents' | remove: '```' | remove: '---' | replace: '\', ' ' | replace: ' . . . ', ' . ' | replace: ' . . ', ' . ' | normalize_whitespace }}", "url": "{{ page.url | absolute_url }}", "relUrl": "{{ page.url }}" - }{% unless forloop.last %},{% endunless %} + }{% assign comma = true %} {% endif %}{% endfor %} -} +} \ No newline at end of file diff --git a/docs/configuration.md b/docs/configuration.md index 14422fdfa64bcc58eec9f6ee8cbce802d5a4104e..eb43a086f9572ed1fb249ab1fc483eeb0929dba3 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -22,12 +22,23 @@ Just the Docs has some specific configuration parameters that can be defined in View this site's [_config.yml](https://github.com/pmarsceill/just-the-docs/tree/master/_config.yml) file as an example. -## Search enabled +## Site logo + +```yaml +# Set a path/url to a logo that will be displayed instead of the title +logo: "/assets/images/just-the-docs.png" +``` + +## Search ```yaml # Enable or disable the site search -# Support true (default) or false +# Supports true (default) or false search_enabled: true + +# Enable support for hyphenated search words: +search_tokenizer_separator: /[\s/]+/ + ``` ## Aux links @@ -35,18 +46,17 @@ search_enabled: true ```yaml # Aux links for the upper right navigation aux_links: - "Just the Docs on GitHub": - - "//github.com/pmarsceill/just-the-docs" + "Just the Docs on GitHub": + - "//github.com/pmarsceill/just-the-docs" ``` ## Heading anchor links ```yaml -# Heading anchor links appear on hover over h1-h6 tags -# in page content allowing users to deep link to a particular -# heading on a page. +# Heading anchor links appear on hover over h1-h6 tags in page content +# allowing users to deep link to a particular heading on a page. # -# Supprts true (default) or false/nil +# Supports true (default) or false/nil heading_anchors: true ``` @@ -65,20 +75,7 @@ color_scheme: "dark" ``` <button class="btn js-toggle-dark-mode">Preview dark color scheme</button> -<script> -const toggleDarkMode = document.querySelector('.js-toggle-dark-mode'); -const cssFile = document.querySelector('[rel="stylesheet"]'); -const originalCssRef = cssFile.getAttribute('href'); -const darkModeCssRef = originalCssRef.replace('just-the-docs.css', 'dark-mode-preview.css'); - -jtd.addEvent(toggleDarkMode, 'click', function(){ - if (cssFile.getAttribute('href') === originalCssRef) { - cssFile.setAttribute('href', darkModeCssRef); - } else { - cssFile.setAttribute('href', originalCssRef); - } -}) -</script> +<script type="text/javascript" src="{{ "/assets/js/dark-mode-preview.js" | absolute_url }}"></script> See [Customization]({{ site.baseurl }}{% link docs/customization.md %}) for more information. diff --git a/docs/customization.md b/docs/customization.md index eccb4bc2791e3e1867d9aa06dbbcda139e66f9db..883c94c14db18675f5aebab5d27e4dfbe279220c 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -34,20 +34,7 @@ color_scheme: "dark" ``` <button class="btn js-toggle-dark-mode">Preview dark color scheme</button> -<script> -const toggleDarkMode = document.querySelector('.js-toggle-dark-mode'); -const cssFile = document.querySelector('[rel="stylesheet"]'); -const originalCssRef = cssFile.getAttribute('href'); -const darkModeCssRef = originalCssRef.replace('just-the-docs.css', 'dark-mode-preview.css'); - -jtd.addEvent(toggleDarkMode, 'click', function(){ - if (cssFile.getAttribute('href') === originalCssRef) { - cssFile.setAttribute('href', darkModeCssRef); - } else { - cssFile.setAttribute('href', originalCssRef); - } -}) -</script> +<script type="text/javascript" src="{{ "/assets/js/dark-mode-preview.js" | absolute_url }}"></script> ## Specific visual customization @@ -69,3 +56,20 @@ $link-color: $blue-000; ``` _Note:_ Editing the variables directly in `_sass/support/variables.scss` is not recommended and can cause other dependencies to fail. + +## Override styles + +For styles that aren't defined as a variables, you may want to modify specific CSS classes. To add your own CSS overrides at the end of the cascade, edit `_sass/overrides.scss`. This will allow for all overrides to be kept in a single file, and for any upstream changes to still be applied. + +For example, if you'd like to add your own styles for printing a page, you could add the following styles. + +#### Example +{: .no_toc } + +```scss +// Print-only styles. +@media print { + .side-bar, .page-header { display: none; } + .main-content { max-width: auto; margin: 1em;} +} +``` diff --git a/docs/navigation-structure.md b/docs/navigation-structure.md index 98107cfcc3807de00ccbbcd73a8566019f8c8879..a4fef75ef4a46d8e6bd5684652febb99c90f3e74 100644 --- a/docs/navigation-structure.md +++ b/docs/navigation-structure.md @@ -67,7 +67,7 @@ Sometimes you will want to create a page with many children (a section). First, | |-- docs | |-- ui-components -| | |-- ui-components.md (parent page) +| | |-- index.md (parent page) | | |-- buttons.md | | |-- code.md | | |-- labels.md @@ -75,7 +75,7 @@ Sometimes you will want to create a page with many children (a section). First, | | +-- typography.md | | | |-- utilities -| | |-- utilities.md (parent page) +| | |-- index.md (parent page) | | |-- color.md | | |-- layout.md | | |-- responsive-modifiers.md @@ -88,9 +88,8 @@ Sometimes you will want to create a page with many children (a section). First, +-- .. ``` -On the parent pages, add 2 YAML front matter parameters: +On the parent pages, add this YAML front matter parameter: - `has_children: true` (tells us that this is a parent page) -- `permalink:` set this to the site directory that contains the child pages #### Example {: .no_toc } @@ -101,7 +100,6 @@ layout: default title: UI Components nav_order: 2 has_children: true -permalink: /docs/ui-components --- ``` @@ -140,7 +138,6 @@ title: UI Components nav_order: 2 has_children: true has_toc: false -permalink: /docs/ui-components --- ``` diff --git a/docs/search.md b/docs/search.md index 134e3997bccdc02afe30e101dad3ce0804fe124c..35567863a2e6ca3d173c32926bfb85cd790c7c5c 100644 --- a/docs/search.md +++ b/docs/search.md @@ -37,13 +37,13 @@ This command creates the `search-data.json` file that Jekyll uses to create your {% raw %}--- --- { - {% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": { - "id": "{{ forloop.index0 }}", + {% assign comma = false %} + {% for page in site.html_pages %}{% if page.search_exclude != true %}{% if comma == true%},{% endif %}"{{ forloop.index0 }}": { "title": "{{ page.title | replace: '&', '&' }}", - "content": "{{ page.content | markdownify | strip_html | escape_once | remove: 'Table of contents' | remove: '```' | remove: '---' | replace: '\', ' ' | normalize_whitespace }}", + "content": "{{ page.content | markdownify | replace: '</h', ' . </h' | replace: '<hr', ' . <hr' | replace: '</p', ' . </p' | replace: '</ul', ' . </ul' | replace: '</tr', ' . </tr' | replace: '</li', ' | </li' | replace: '</td', ' | </td' | strip_html | escape_once | remove: 'Table of contents' | remove: '```' | remove: '---' | replace: '\', ' ' | replace: ' . . . ', ' . ' | replace: ' . . ', ' . ' | normalize_whitespace }}", "url": "{{ page.url | absolute_url }}", "relUrl": "{{ page.url }}" - }{% unless forloop.last %},{% endunless %} + }{% assign comma = true %} {% endif %}{% endfor %} }{% endraw %} ``` @@ -59,6 +59,15 @@ In your site's `_config.yml`, enable search: search_enabled: true ``` +The default is for hyphens to separate tokens in search terms: +`gem-based` is equivalent to `gem based`, matching either word. +To allow search for hyphenated words: + +```yaml +# Set the search token separator +search_tokenizer_separator: /[\s/]+/ +``` + ## Hiding pages from search Sometimes you might have a page that you don't want to be indexed for the search nor to show up in search results, e.g, a 404 page. To exclude a page from search, add the `search_exclude: true` parameter to the page's YAML front matter: diff --git a/index.md b/index.md index 3d2e7c47548be1a6de830bbbd91602c3f511e353..7be9b224344075ece46186920ef6492f7b255c02 100644 --- a/index.md +++ b/index.md @@ -20,7 +20,7 @@ Just the Docs gives your documentation a jumpstart with a responsive Jekyll them ### Dependencies -Just the Docs is built for [Jekyll](https://jekyllrb.com), a static site generator. View the [quick start guide](https://jekyllrb.com/docs/) for more information. Just the Docs requires no special Jekyll plugins and can run on GitHub Pages' standard Jekyll compiler. +Just the Docs is built for [Jekyll](https://jekyllrb.com), a static site generator. View the [quick start guide](https://jekyllrb.com/docs/) for more information. Just the Docs requires no special plugins and can run on GitHub Pages' standard Jekyll compiler. The [Jekyll SEO Tag plugin](https://github.com/jekyll/jekyll-seo-tag) is included by default (no need to run any special installation) to inject SEO and open graph metadata on docs pages. For information on how to configure SEO and open graph metadata visit the [Jekyll SEO Tag usage guide](https://jekyll.github.io/jekyll-seo-tag/usage/). ### Quick start: Use as a GitHub Pages remote theme @@ -79,6 +79,16 @@ Just the Docs is distributed by an [MIT license](https://github.com/pmarsceill/j When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change. Read more about becoming a contributor in [our GitHub repo](https://github.com/pmarsceill/just-the-docs#contributing). +#### Thank you to the contributors of Just the Docs! + +<ul class="list-style-none"> +{% for contributor in site.github.contributors %} + <li class="d-inline-block mr-1"> + <a href="{{ contributor.html_url }}"><img src="{{ contributor.avatar_url }}" width="32" height="32" alt="{{ contributor.login }}"/></a> + </li> +{% endfor %} +</ul> + ### Code of Conduct Just the Docs is committed to fostering a welcoming community. diff --git a/just-the-docs.gemspec b/just-the-docs.gemspec index ad1c777e43de64e619be891de33be12aa8e55dd1..4be9738d29fe1180b8be3573a645203f8383f6c4 100644 --- a/just-the-docs.gemspec +++ b/just-the-docs.gemspec @@ -2,11 +2,11 @@ Gem::Specification.new do |spec| spec.name = "just-the-docs" - spec.version = "0.2.6" + spec.version = "0.2.7" spec.authors = ["Patrick Marsceill"] spec.email = ["patrick.marsceill@gmail.com"] - spec.summary = %q{A modern, high customizable, responsive Jekyll theme for documention with built-in search.} + spec.summary = %q{A modern, highly customizable, and responsive Jekyll theme for documention with built-in search.} spec.homepage = "https://github.com/pmarsceill/just-the-docs" spec.license = "MIT" diff --git a/lib/tasks/search.rake b/lib/tasks/search.rake index 44ee417b68f6f86f1be55d60c456508054ce6098..82dcfb6ce9d63ad0927417c01c74efa8fab14d49 100644 --- a/lib/tasks/search.rake +++ b/lib/tasks/search.rake @@ -4,7 +4,7 @@ namespace :search do puts 'Creating search data json file...' mkdir_p 'assets/js' touch 'assets/js/search-data.json' - content = %Q[{{ page.content | markdownify | strip_html | escape_once | remove: 'Table of contents' | remove: '```' | remove: '---' | replace: '\\', ' ' | normalize_whitespace }}] + content = %Q[{{ page.content | markdownify | replace: '</h', ' . </h' | replace: '<hr', ' . <hr' | replace: '</p', ' . </p' | replace: '</ul', ' . </ul' | replace: '</tr', ' . </tr' | replace: '</li', ' | </li' | replace: '</td', ' | </td' | strip_html | escape_once | remove: 'Table of contents' | remove: '```' | remove: '---' | replace: '\', ' ' | replace: ' . . . ', ' . ' | replace: ' . . ', ' . ' | normalize_whitespace }}] puts 'Done.' puts 'Generating content...' @@ -12,13 +12,13 @@ namespace :search do f.puts '--- --- { - {% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": { - "id": "{{ forloop.index0 }}", - "title": "{{ page.title | replace: \'&\', \'&\' }}", + {% assign comma = false %} + {% for page in site.html_pages %}{% if page.search_exclude != true %}{% if comma == true%},{% endif %}"{{ forloop.index0 }}": { + "title": "{{ page.title | replace: '&', '&' }}", "content": "'+content+'", "url": "{{ page.url | absolute_url }}", "relUrl": "{{ page.url }}" - }{% unless forloop.last %},{% endunless %} + }{% assign comma = true %} {% endif %}{% endfor %} }' end diff --git a/package-lock.json b/package-lock.json index 1d6b72ad00318834d2b4d6bc6a00cd99e1cfc323..d1c2620cfc3e68d039a874fe58be346ffe78d601 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "just-the-docs", - "version": "0.2.5", + "version": "0.2.6", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -177,11 +177,11 @@ "dev": true }, "@primer/css": { - "version": "12.6.0", - "resolved": "https://registry.npmjs.org/@primer/css/-/css-12.6.0.tgz", - "integrity": "sha512-GzQr/MPCbTlgvAd4bEXy4RA5cZvz7k/wkCzG7sOmjB9g9EtGnkzmLz6aS58EBRJsxfe6QU/iZ2/N/66/Bn5eZA==", + "version": "12.7.0", + "resolved": "https://registry.npmjs.org/@primer/css/-/css-12.7.0.tgz", + "integrity": "sha512-EVqfwX1jxKWQoV9IxxCJQG7HlyKefdkYTJdnDV43Rr1cyidUTkQN9W0uMuN+RD9cmAzip/40b2E+7gsvsFDmBA==", "requires": { - "@primer/octicons": "9.1.1" + "@primer/octicons": "^9.1.1" } }, "@primer/octicons": { @@ -548,14 +548,22 @@ } }, "browserslist": { - "version": "4.5.6", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.5.6.tgz", - "integrity": "sha512-o/hPOtbU9oX507lIqon+UvPYqpx3mHc8cV3QemSBTXwkG8gSQSK6UKvXcE/DcleU3+A59XTUHyCvZ5qGy8xVAg==", + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.7.0.tgz", + "integrity": "sha512-9rGNDtnj+HaahxiVV38Gn8n8Lr8REKsel68v1sPFfIGEK6uSXTY3h9acgiT1dZVtOOUtifo/Dn8daDQ5dUgVsA==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30000963", - "electron-to-chromium": "^1.3.127", - "node-releases": "^1.1.17" + "caniuse-lite": "^1.0.30000989", + "electron-to-chromium": "^1.3.247", + "node-releases": "^1.1.29" + }, + "dependencies": { + "electron-to-chromium": { + "version": "1.3.254", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.254.tgz", + "integrity": "sha512-7I5/OkgR6JKy6RFLJeru0kc0RMmmMu1UnkHBKInFKRrg1/4EQKIqOaUqITSww/SZ1LqWwp1qc/LLoIGy449eYw==", + "dev": true + } } }, "cache-base": { @@ -629,9 +637,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30000963", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000963.tgz", - "integrity": "sha512-n4HUiullc7Lw0LyzpeLa2ffP8KxFBGdxqD/8G3bSL6oB758hZ2UE2CVK+tQN958tJIi0/tfpjAc67aAtoHgnrQ==", + "version": "1.0.30000989", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000989.tgz", + "integrity": "sha512-vrMcvSuMz16YY6GSVZ0dWDTJP8jqk3iFQ/Aq5iqblPwxSVVZI+zxDyTX0VPqtQsDnfdrBDcsmhgTEOh5R8Lbpw==", "dev": true }, "ccount": { @@ -1083,9 +1091,9 @@ } }, "cssesc": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-2.0.0.tgz", - "integrity": "sha512-MsCAG1z9lPdoO/IUMLSBWBSVxVtJ1395VGIQ+Fc2gNdkQ1hNDnQdw3YhA71WJCBW1vdwA0cAnk/DnW6bqoEUYg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", "dev": true }, "currently-unhandled": { @@ -2776,9 +2784,9 @@ } }, "mixin-deep": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", - "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", + "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", "dev": true, "requires": { "for-in": "^1.0.2", @@ -2849,9 +2857,9 @@ "dev": true }, "node-releases": { - "version": "1.1.17", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.17.tgz", - "integrity": "sha512-/SCjetyta1m7YXLgtACZGDYJdCSIBAWorDWkGCGZlydP2Ll7J48l7j/JxNYZ+xsgSPbWfdulVS/aY+GdjUsQ7Q==", + "version": "1.1.30", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.30.tgz", + "integrity": "sha512-BHcr1g6NeUH12IL+X3Flvs4IOnl1TL0JczUhEZjDE+FXXPQcVCNr8NEPb01zqGxzhTpdyJL5GXemaCW7aw6Khw==", "dev": true, "requires": { "semver": "^5.3.0" @@ -4299,15 +4307,14 @@ } }, "stylelint-config-primer": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/stylelint-config-primer/-/stylelint-config-primer-7.0.1.tgz", - "integrity": "sha512-yuKUU/0Z490FOp4gEGOebdXOcc0T0Kx07qygXImNZp4xisTkDabSEFUxfj8SzLybe08pPyuTFoJeCD65jXExuQ==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/stylelint-config-primer/-/stylelint-config-primer-8.0.0.tgz", + "integrity": "sha512-PRhlYe/6x1H9Lbfr/j/RFGT3vnUGmpvTATl01TVsy43tEAZVELzQRfSdgg18WuegJo3LSRkgM8rxbz0eX3Ucdw==", "dev": true, "requires": { "stylelint-no-unsupported-browser-features": "^1.0.0", "stylelint-order": "^2.0.0", - "stylelint-scss": "3.5.2", - "stylelint-selector-no-utility": "4.0.0" + "stylelint-scss": "^3.10.0" } }, "stylelint-no-unsupported-browser-features": { @@ -4356,28 +4363,34 @@ } }, "stylelint-scss": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/stylelint-scss/-/stylelint-scss-3.5.2.tgz", - "integrity": "sha512-HL95s8Q6wihbJe7c7z6rL9GHVHOF3H3tXkVmGutitwn14LYR52JYMwCkcifqlf4nRsvXrUDaoH6OHOdilifyjw==", + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/stylelint-scss/-/stylelint-scss-3.10.1.tgz", + "integrity": "sha512-YnzYmcLd5DGGsjfoj44gArjo3TWhMWjS/ytfu+1HKtToZae5ditZOXHBmrgitsHvNk9mzp5WO3/PjA5IO1GpUw==", "dev": true, "requires": { - "lodash": "^4.17.11", + "lodash": "^4.17.15", "postcss-media-query-parser": "^0.2.3", "postcss-resolve-nested-selector": "^0.1.1", - "postcss-selector-parser": "^5.0.0", - "postcss-value-parser": "^3.3.1" + "postcss-selector-parser": "^6.0.2", + "postcss-value-parser": "^4.0.2" }, "dependencies": { "postcss-selector-parser": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-5.0.0.tgz", - "integrity": "sha512-w+zLE5Jhg6Liz8+rQOWEAwtwkyqpfnmsinXjXg6cY7YIONZZtgvE0v2O0uhQBs0peNomOJwWRKt6JBfTdTd3OQ==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.2.tgz", + "integrity": "sha512-36P2QR59jDTOAiIkqEprfJDsoNrvwFei3eCqKd1Y0tUsBimsq39BLp7RD+JWny3WgB1zGhJX8XVePwm9k4wdBg==", "dev": true, "requires": { - "cssesc": "^2.0.0", + "cssesc": "^3.0.0", "indexes-of": "^1.0.1", "uniq": "^1.0.1" } + }, + "postcss-value-parser": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.0.2.tgz", + "integrity": "sha512-LmeoohTpp/K4UiyQCwuGWlONxXamGzCMtFxLq4W1nZVGIQLYvMCJx3yAF9qyyuFpflABI9yVdtJAqbihOsCsJQ==", + "dev": true } } }, @@ -5824,9 +5837,9 @@ } }, "p-limit": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", - "integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", + "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==", "dev": true, "requires": { "p-try": "^2.0.0" diff --git a/package.json b/package.json index 0c5a8ea2a2a2253a804d5d69b300df107250465f..ddf811195d129694e8e98c3e22bd32dc069dc15d 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,17 @@ { "name": "just-the-docs", - "version": "0.2.6", + "version": "0.2.7", "description": "A modern Jekyll theme for documentation", "repository": "pmarsceill/just-the-docs", "license": "MIT", "bugs": "https://github.com/pmarsceill/just-the-docs/issues", "devDependencies": { "stylelint": "^10.0.1", - "stylelint-config-primer": "^7.0.1", + "stylelint-config-primer": "^8.0.0", "stylelint-selector-no-utility": "^4.0.0" }, "dependencies": { - "@primer/css": "^12.6.0" + "@primer/css": "^12.7.0" }, "scripts": { "test": "stylelint '**/*.scss'"