From 331972b1ac5073cf1984e88915e37f16209420ce Mon Sep 17 00:00:00 2001 From: John Fairhurst Date: Wed, 29 Sep 2021 10:56:06 +0100 Subject: [PATCH 1/6] Basic fixes Fixed `noopener`, missing alt-text, stray `` --- lib/jazzy/jazzy_markdown.rb | 2 +- lib/jazzy/themes/apple/templates/doc.mustache | 3 +-- lib/jazzy/themes/apple/templates/footer.mustache | 2 +- lib/jazzy/themes/apple/templates/header.mustache | 4 ++-- lib/jazzy/themes/fullwidth/templates/doc.mustache | 3 +-- lib/jazzy/themes/fullwidth/templates/footer.mustache | 2 +- lib/jazzy/themes/fullwidth/templates/header.mustache | 4 ++-- lib/jazzy/themes/jony/templates/doc.mustache | 3 +-- lib/jazzy/themes/jony/templates/footer.mustache | 2 +- lib/jazzy/themes/jony/templates/header.mustache | 4 ++-- 10 files changed, 13 insertions(+), 16 deletions(-) diff --git a/lib/jazzy/jazzy_markdown.rb b/lib/jazzy/jazzy_markdown.rb index d31346f06..6c288cc1b 100644 --- a/lib/jazzy/jazzy_markdown.rb +++ b/lib/jazzy/jazzy_markdown.rb @@ -275,7 +275,7 @@ def self.rendered_parameters class JazzyCopyright < Redcarpet::Render::HTML def link(link, _title, content) %(#{content}) +rel="external noopener">#{content}) end end diff --git a/lib/jazzy/themes/apple/templates/doc.mustache b/lib/jazzy/themes/apple/templates/doc.mustache index 32c097ce3..41337ce96 100644 --- a/lib/jazzy/themes/apple/templates/doc.mustache +++ b/lib/jazzy/themes/apple/templates/doc.mustache @@ -29,7 +29,7 @@
@@ -85,5 +85,4 @@ - diff --git a/lib/jazzy/themes/apple/templates/footer.mustache b/lib/jazzy/themes/apple/templates/footer.mustache index 6b703355e..2ff891131 100644 --- a/lib/jazzy/themes/apple/templates/footer.mustache +++ b/lib/jazzy/themes/apple/templates/footer.mustache @@ -1,4 +1,4 @@ diff --git a/lib/jazzy/themes/apple/templates/header.mustache b/lib/jazzy/themes/apple/templates/header.mustache index b83b23b40..3e3bc097f 100644 --- a/lib/jazzy/themes/apple/templates/header.mustache +++ b/lib/jazzy/themes/apple/templates/header.mustache @@ -2,10 +2,10 @@

{{docs_title}}{{#doc_coverage}} ({{doc_coverage}}% documented){{/doc_coverage}}

{{#source_host_url}} -

View on {{source_host_name}}

+

{{source_host_name}}View on {{source_host_name}}

{{/source_host_url}} {{#dash_url}} -

Install in Dash

+

DashInstall in Dash

{{/dash_url}} {{^disable_search}}

diff --git a/lib/jazzy/themes/fullwidth/templates/doc.mustache b/lib/jazzy/themes/fullwidth/templates/doc.mustache index ffed85517..4d7955c47 100644 --- a/lib/jazzy/themes/fullwidth/templates/doc.mustache +++ b/lib/jazzy/themes/fullwidth/templates/doc.mustache @@ -32,7 +32,7 @@

@@ -91,5 +91,4 @@
{{> footer}} - diff --git a/lib/jazzy/themes/fullwidth/templates/footer.mustache b/lib/jazzy/themes/fullwidth/templates/footer.mustache index e1224411e..189701d75 100644 --- a/lib/jazzy/themes/fullwidth/templates/footer.mustache +++ b/lib/jazzy/themes/fullwidth/templates/footer.mustache @@ -1,4 +1,4 @@ diff --git a/lib/jazzy/themes/fullwidth/templates/header.mustache b/lib/jazzy/themes/fullwidth/templates/header.mustache index 2c8a12217..e88fcfed3 100644 --- a/lib/jazzy/themes/fullwidth/templates/header.mustache +++ b/lib/jazzy/themes/fullwidth/templates/header.mustache @@ -17,7 +17,7 @@ {{#source_host_url}}

- + {{source_host_name}} View on {{source_host_name}}

@@ -26,7 +26,7 @@ {{#dash_url}}

- + Dash Install in Dash

diff --git a/lib/jazzy/themes/jony/templates/doc.mustache b/lib/jazzy/themes/jony/templates/doc.mustache index 57c146be8..b5a4d8a3d 100644 --- a/lib/jazzy/themes/jony/templates/doc.mustache +++ b/lib/jazzy/themes/jony/templates/doc.mustache @@ -27,7 +27,7 @@ @@ -91,5 +91,4 @@ - diff --git a/lib/jazzy/themes/jony/templates/footer.mustache b/lib/jazzy/themes/jony/templates/footer.mustache index 6b703355e..2ff891131 100644 --- a/lib/jazzy/themes/jony/templates/footer.mustache +++ b/lib/jazzy/themes/jony/templates/footer.mustache @@ -1,4 +1,4 @@ diff --git a/lib/jazzy/themes/jony/templates/header.mustache b/lib/jazzy/themes/jony/templates/header.mustache index bd8a815ac..6975a0f25 100644 --- a/lib/jazzy/themes/jony/templates/header.mustache +++ b/lib/jazzy/themes/jony/templates/header.mustache @@ -8,7 +8,7 @@ {{#source_host_url}}

- + {{source_host_name}} View on {{source_host_name}}

@@ -17,7 +17,7 @@ {{#dash_url}}

- + Dash Install in Dash

From 4e01947d3eaa60b9dcaab78c07ce6276552bcde9 Mon Sep 17 00:00:00 2001 From: John Fairhurst Date: Wed, 29 Sep 2021 10:57:06 +0100 Subject: [PATCH 2/6] Malformed footnote lists --- lib/jazzy/jazzy_markdown.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/jazzy/jazzy_markdown.rb b/lib/jazzy/jazzy_markdown.rb index 6c288cc1b..8083badae 100644 --- a/lib/jazzy/jazzy_markdown.rb +++ b/lib/jazzy/jazzy_markdown.rb @@ -40,7 +40,8 @@ def footnote_def(text, num) mapped = map_footnote(num) "\n
  • " + text.sub(%r{(?=

    )}, - " 
  • ") + " ") + + '' end end From afa08168b10b1d15e8c09c76ed98a2dab3b05604 Mon Sep 17 00:00:00 2001 From: John Fairhurst Date: Wed, 29 Sep 2021 11:05:39 +0100 Subject: [PATCH 3/6] Malformed math blocks --- lib/jazzy/jazzy_markdown.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/jazzy/jazzy_markdown.rb b/lib/jazzy/jazzy_markdown.rb index 8083badae..f998357a7 100644 --- a/lib/jazzy/jazzy_markdown.rb +++ b/lib/jazzy/jazzy_markdown.rb @@ -67,7 +67,9 @@ def header(text, header_level) def codespan(text) case text when /^\$\$(.*)\$\$$/m - o = ["
    ", Regexp.last_match[1], '
    '] + o = ["

    ", + Regexp.last_match[1], + '

    '] Markdown.has_math = true when /^\$(.*)\$$/m o = ["", Regexp.last_match[1], ''] From 5d0fe1cf4b5a1696a09a28b45b5cf3abbcc94bcb Mon Sep 17 00:00:00 2001 From: John Fairhurst Date: Thu, 30 Sep 2021 10:24:21 +0100 Subject: [PATCH 4/6] Badly formed search bar --- lib/jazzy/themes/apple/templates/header.mustache | 4 ++-- lib/jazzy/themes/fullwidth/templates/header.mustache | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/jazzy/themes/apple/templates/header.mustache b/lib/jazzy/themes/apple/templates/header.mustache index 3e3bc097f..ec1adf7cf 100644 --- a/lib/jazzy/themes/apple/templates/header.mustache +++ b/lib/jazzy/themes/apple/templates/header.mustache @@ -8,11 +8,11 @@

    DashInstall in Dash

    {{/dash_url}} {{^disable_search}} -

    +

    -

    +
    {{/disable_search}} diff --git a/lib/jazzy/themes/fullwidth/templates/header.mustache b/lib/jazzy/themes/fullwidth/templates/header.mustache index e88fcfed3..a9262d3eb 100644 --- a/lib/jazzy/themes/fullwidth/templates/header.mustache +++ b/lib/jazzy/themes/fullwidth/templates/header.mustache @@ -7,11 +7,11 @@

    {{^disable_search}} -

    +

    -

    +
    {{/disable_search}} {{#source_host_url}} From 283a3574225b7ba984145abc544dc2e48bb8083c Mon Sep 17 00:00:00 2001 From: John Fairhurst Date: Thu, 30 Sep 2021 10:31:03 +0100 Subject: [PATCH 5/6] Malformed section headers --- lib/jazzy/doc_builder.rb | 7 ++++++- lib/jazzy/jazzy_markdown.rb | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/jazzy/doc_builder.rb b/lib/jazzy/doc_builder.rb index 8de6a5d8d..88aef44b4 100644 --- a/lib/jazzy/doc_builder.rb +++ b/lib/jazzy/doc_builder.rb @@ -236,6 +236,11 @@ def self.render(doc_model, markdown) SourceKitten.autolink_document(html, doc_model) end + def self.render_inline(doc_model, markdown) + html = Markdown.render_inline(markdown) + SourceKitten.autolink_document(html, doc_model) + end + # Build Mustache document - common fields between page types def self.new_document(source_module, doc_model) Doc.new.tap do |doc| @@ -379,7 +384,7 @@ def self.render_item(item, source_module) def self.make_task(mark, uid, items, doc_model) { name: mark.name, - name_html: (render(doc_model, mark.name) if mark.name), + name_html: (render_inline(doc_model, mark.name) if mark.name), uid: ERB::Util.url_encode(uid), items: items, pre_separator: mark.has_start_dash, diff --git a/lib/jazzy/jazzy_markdown.rb b/lib/jazzy/jazzy_markdown.rb index f998357a7..136300b37 100644 --- a/lib/jazzy/jazzy_markdown.rb +++ b/lib/jazzy/jazzy_markdown.rb @@ -261,12 +261,19 @@ def self.markdown @markdown ||= Redcarpet::Markdown.new(renderer, REDCARPET_OPTIONS) end + # Produces

    -delimited block content def self.render(markdown_text, default_language = nil) renderer.reset renderer.default_language = default_language markdown.render(markdown_text) end + # Produces -delimited inline content + def self.render_inline(markdown_text, default_language = nil) + render(markdown_text, default_language) + .sub(%r{^

    (.*)

    $}, '\1') + end + def self.rendered_returns renderer.returns end From 478c79cc9b355493e8615a8fb51cbb531474f16f Mon Sep 17 00:00:00 2001 From: John Fairhurst Date: Thu, 30 Sep 2021 10:57:22 +0100 Subject: [PATCH 6/6] Rebuild specs --- CHANGELOG.md | 4 +++- spec/integration_specs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 036ffb475..3a277ef38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,9 @@ ##### Bug Fixes -* None. +* Improve HTML5 correctness, all themes. + [John Fairhurst](https://github.com/johnfairh) + [#1280](https://github.com/realm/jazzy/issues/1280) ## 0.14.0 diff --git a/spec/integration_specs b/spec/integration_specs index c28a0b31e..514082872 160000 --- a/spec/integration_specs +++ b/spec/integration_specs @@ -1 +1 @@ -Subproject commit c28a0b31eb89969f59ea25f466f0c3cac7435d19 +Subproject commit 5140828721d07146b4ca3742d61fbba317387bfe