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/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 d31346f06..136300b37 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 @@ -66,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], ''] @@ -258,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 @@ -275,7 +285,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..ec1adf7cf 100644 --- a/lib/jazzy/themes/apple/templates/header.mustache +++ b/lib/jazzy/themes/apple/templates/header.mustache @@ -2,17 +2,17 @@

    {{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}} -

    +

    -

    +
    {{/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..a9262d3eb 100644 --- a/lib/jazzy/themes/fullwidth/templates/header.mustache +++ b/lib/jazzy/themes/fullwidth/templates/header.mustache @@ -7,17 +7,17 @@

    {{^disable_search}} -

    +

    -

    +
    {{/disable_search}} {{#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

    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