From 71ba32e131790e082b6a723005923936454b3448 Mon Sep 17 00:00:00 2001 From: EricFromCanada Date: Tue, 15 Jan 2019 20:43:19 -0500 Subject: [PATCH 1/4] Additional text fixes --- docs/configuration.md | 8 ++++---- docs/customization.md | 4 ++-- docs/navigation-structure.md | 2 +- docs/search.md | 6 +++--- just-the-docs.gemspec | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index fcab4953165db..64b23f1a26399 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -6,18 +6,18 @@ nav_order: 2 # Configuration -Just the Docs has some specific configuration parameters that can be definied in your Jekyll site's `_config.yml` file. +Just the Docs has some specific configuration parameters that can be defined in your Jekyll site's `_config.yml` file. ## Search enabled -```yml +```yaml # Enable or disable the site search search_enabled: true ``` ## Aux links -```yml +```yaml # Aux links for the upper right navigation aux_links: "Just the Docs on GitHub": @@ -26,7 +26,7 @@ aux_links: ## Color scheme -```yml +```yaml # Color scheme currently only supports "dark" or nil (default) color_scheme: "dark" ``` diff --git a/docs/customization.md b/docs/customization.md index 74c153c0bff7f..f3fe1c036d6bb 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -28,7 +28,7 @@ To enable a color scheme, set the `color_scheme` parameter in your site's `_conf #### Example {: .no_toc } -```yml +```yaml # Color scheme currently only supports "dark" or nil (default) color_scheme: "dark" ``` @@ -68,6 +68,6 @@ $link-color: $blue-000; // ... ``` -_Note:_ Editing the variables directly in `_sass/support/variables.scss` is not recommended and can cause other dependancies to fail. +_Note:_ Editing the variables directly in `_sass/support/variables.scss` is not recommended and can cause other dependencies to fail. --- diff --git a/docs/navigation-structure.md b/docs/navigation-structure.md index 8a72e5ba0cf3a..98107cfcc3807 100644 --- a/docs/navigation-structure.md +++ b/docs/navigation-structure.md @@ -200,7 +200,7 @@ To add a auxiliary navigation item to your site (in the upper right on all pages #### Example {: .no_toc } -```yml +```yaml # Aux links for the upper right navigation aux_links: "Just the Docs on GitHub": diff --git a/docs/search.md b/docs/search.md index 24afcd1bc0479..61822d5a073f7 100644 --- a/docs/search.md +++ b/docs/search.md @@ -33,8 +33,8 @@ $ bundle exec just-the-docs rake search:init This command creates the `search-data.json` file that Jekyll uses to create your search index. Alternatively, you can create the file manually in the `assets/js/` directory of your Jekyll site with this content: -```{% raw %} ---- +```liquid +{% raw %}--- --- { {% for page in site.html_pages %}"{{ forloop.index0 }}": { @@ -54,7 +54,7 @@ _Note: If you don't run this rake command or create this file manually, search w In your site's `_config.yml`, enable search: -```yml +```yaml # Enable or disable the site search search_enabled: true ``` diff --git a/just-the-docs.gemspec b/just-the-docs.gemspec index 7a0260377a8f9..aba1bb57f3519 100644 --- a/just-the-docs.gemspec +++ b/just-the-docs.gemspec @@ -6,7 +6,7 @@ Gem::Specification.new do |spec| spec.authors = ["Patrick Marsceill"] spec.email = ["patrick.marsceill@gmail.com"] - spec.summary = %q{A nice looking, high customizable, responsive Jekyll theme for documention with built-in search.} + spec.summary = %q{A nice looking, highly customizable, responsive Jekyll theme for documentation with built-in search.} spec.homepage = "https://github.com/pmarsceill/just-the-docs" spec.license = "MIT" From 793ea356c37b3c406bc1b3af35f390b3c08302a5 Mon Sep 17 00:00:00 2001 From: EricFromCanada Date: Tue, 15 Jan 2019 20:48:00 -0500 Subject: [PATCH 2/4] Use `unless` loop for comma and mention `search_exclude` --- assets/js/search-data.json | 2 +- docs/search.md | 4 ++-- lib/tasks/search.rake | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/assets/js/search-data.json b/assets/js/search-data.json index 12de52214628d..e78d186032d66 100644 --- a/assets/js/search-data.json +++ b/assets/js/search-data.json @@ -7,6 +7,6 @@ "content": "{{ page.content | newline_to_br | replace: '
', ' ' | replace: '', ' ' | strip_newlines | markdownify | strip_html | remove: 'Table of contents' | xml_excape | escape | replace: '\', ' ' | replace: '```', '' | replace: ' ', ' ' | replace: ' ', ' ' | remove: '---' | remove: '#####' | remove: '####' | remove: '###' | remove: '##' | strip_newlines }}", "url": "{{ page.url | absolute_url | xml_escape }}", "relUrl": "{{ page.url | xml_escape }}" - }{% if forloop.last %}{% else %},{% endif %} + }{% unless forloop.last %},{% endunless %} {% endif %}{% endfor %} } diff --git a/docs/search.md b/docs/search.md index 61822d5a073f7..33a9555d897b5 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 %}"{{ forloop.index0 }}": { + {% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": { "id": "{{ forloop.index0 }}", "title": "{{ page.title | xml_escape }}", "content": "{{ page.content | markdownify | strip_html | xml_escape | remove: 'Table of contents' | remove: page.title | strip_newlines | replace: '\', ' '}}", "url": "{{ page.url | absolute_url | xml_escape }}", "relUrl": "{{ page.url | xml_escape }}" - }{% if forloop.last %}{% else %}, + }{% unless forloop.last %},{% endunless %} {% endif %}{% endfor %} }{% endraw %} ``` diff --git a/lib/tasks/search.rake b/lib/tasks/search.rake index 02d0b5e421b94..bcb01db59ea8e 100644 --- a/lib/tasks/search.rake +++ b/lib/tasks/search.rake @@ -12,13 +12,13 @@ namespace :search do f.puts '--- --- { - {% for page in site.html_pages %}"{{ forloop.index0 }}": { + {% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": { "id": "{{ forloop.index0 }}", "title": "{{ page.title | xml_escape }}", "content": "'+content+'", "url": "{{ page.url | absolute_url | xml_escape }}", "relUrl": "{{ page.url | xml_escape }}" - }{% if forloop.last %}{% else %}, + }{% unless forloop.last %},{% endunless %} {% endif %}{% endfor %} }' end From 9a4ea76957f2ffad6b969606ea828ddf927c15f8 Mon Sep 17 00:00:00 2001 From: EricFromCanada Date: Tue, 15 Jan 2019 21:19:37 -0500 Subject: [PATCH 3/4] Improve search content generator --- assets/js/search-data.json | 2 +- docs/search.md | 2 +- lib/tasks/search.rake | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/js/search-data.json b/assets/js/search-data.json index e78d186032d66..5dffa7bd86340 100644 --- a/assets/js/search-data.json +++ b/assets/js/search-data.json @@ -4,7 +4,7 @@ {% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": { "id": "{{ forloop.index0 }}", "title": "{{ page.title | xml_escape }}", - "content": "{{ page.content | newline_to_br | replace: '
', ' ' | replace: '', ' ' | strip_newlines | markdownify | strip_html | remove: 'Table of contents' | xml_excape | escape | replace: '\', ' ' | replace: '```', '' | replace: ' ', ' ' | replace: ' ', ' ' | remove: '---' | remove: '#####' | remove: '####' | remove: '###' | remove: '##' | strip_newlines }}", + "content": "{{ page.content | markdownify | strip_html | escape_once | remove: 'Table of contents' | remove: '```' | remove: '---' | replace: '\', ' ' | normalize_whitespace }}", "url": "{{ page.url | absolute_url | xml_escape }}", "relUrl": "{{ page.url | xml_escape }}" }{% unless forloop.last %},{% endunless %} diff --git a/docs/search.md b/docs/search.md index 33a9555d897b5..7584c8bfd3931 100644 --- a/docs/search.md +++ b/docs/search.md @@ -40,7 +40,7 @@ This command creates the `search-data.json` file that Jekyll uses to create your {% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": { "id": "{{ forloop.index0 }}", "title": "{{ page.title | xml_escape }}", - "content": "{{ page.content | markdownify | strip_html | xml_escape | remove: 'Table of contents' | remove: page.title | strip_newlines | replace: '\', ' '}}", + "content": "{{ page.content | markdownify | strip_html | escape_once | remove: 'Table of contents' | remove: '```' | remove: '---' | replace: '\', ' ' | normalize_whitespace }}", "url": "{{ page.url | absolute_url | xml_escape }}", "relUrl": "{{ page.url | xml_escape }}" }{% unless forloop.last %},{% endunless %} diff --git a/lib/tasks/search.rake b/lib/tasks/search.rake index bcb01db59ea8e..d91462d22747b 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 | xml_escape | remove: 'Table of contents' | strip_newlines | replace: '\\', ' ' }}] + content = %Q[{{ page.content | markdownify | strip_html | escape_once | remove: 'Table of contents' | remove: '```' | remove: '---' | replace: '\\', ' ' | normalize_whitespace }}] puts 'Done.' puts 'Generating content...' From 60c82cb518a25f43f7c5adbee2b81807115b779e Mon Sep 17 00:00:00 2001 From: EricFromCanada Date: Wed, 16 Jan 2019 00:31:30 -0500 Subject: [PATCH 4/4] Allow for ampersand in title or URL Because `page.title` (and `page.url`) is already escaped and page titles served by lunrjs do not need escaping, ampersands need to be unescaped to display properly in search results. --- assets/js/search-data.json | 6 +++--- docs/search.md | 6 +++--- lib/tasks/search.rake | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/assets/js/search-data.json b/assets/js/search-data.json index 5dffa7bd86340..49cbc9dcbc2ee 100644 --- a/assets/js/search-data.json +++ b/assets/js/search-data.json @@ -3,10 +3,10 @@ { {% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": { "id": "{{ forloop.index0 }}", - "title": "{{ page.title | xml_escape }}", + "title": "{{ page.title | replace: '&', '&' }}", "content": "{{ page.content | markdownify | strip_html | escape_once | remove: 'Table of contents' | remove: '```' | remove: '---' | replace: '\', ' ' | normalize_whitespace }}", - "url": "{{ page.url | absolute_url | xml_escape }}", - "relUrl": "{{ page.url | xml_escape }}" + "url": "{{ page.url | absolute_url }}", + "relUrl": "{{ page.url }}" }{% unless forloop.last %},{% endunless %} {% endif %}{% endfor %} } diff --git a/docs/search.md b/docs/search.md index 7584c8bfd3931..134e3997bccdc 100644 --- a/docs/search.md +++ b/docs/search.md @@ -39,10 +39,10 @@ This command creates the `search-data.json` file that Jekyll uses to create your { {% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": { "id": "{{ forloop.index0 }}", - "title": "{{ page.title | xml_escape }}", + "title": "{{ page.title | replace: '&', '&' }}", "content": "{{ page.content | markdownify | strip_html | escape_once | remove: 'Table of contents' | remove: '```' | remove: '---' | replace: '\', ' ' | normalize_whitespace }}", - "url": "{{ page.url | absolute_url | xml_escape }}", - "relUrl": "{{ page.url | xml_escape }}" + "url": "{{ page.url | absolute_url }}", + "relUrl": "{{ page.url }}" }{% unless forloop.last %},{% endunless %} {% endif %}{% endfor %} }{% endraw %} diff --git a/lib/tasks/search.rake b/lib/tasks/search.rake index d91462d22747b..50ef275c3ec4d 100644 --- a/lib/tasks/search.rake +++ b/lib/tasks/search.rake @@ -14,10 +14,10 @@ namespace :search do { {% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": { "id": "{{ forloop.index0 }}", - "title": "{{ page.title | xml_escape }}", + "title": "{{ page.title | replace: '&', '&' }}", "content": "'+content+'", - "url": "{{ page.url | absolute_url | xml_escape }}", - "relUrl": "{{ page.url | xml_escape }}" + "url": "{{ page.url | absolute_url }}", + "relUrl": "{{ page.url }}" }{% unless forloop.last %},{% endunless %} {% endif %}{% endfor %} }'