Use H2/H3 instead of H3/H4 respectively

General CSS hygiene dictates that you shouldn't go beyond an H3 tag. H1
for the document title, H2 for section headings, and H3 for low-level
headings.
This commit is contained in:
Edward Loveall 2021-08-14 16:12:01 -04:00
parent 5c05086cbd
commit f48f7c2932
No known key found for this signature in database
GPG key ID: 789A4AE983AC8901
5 changed files with 13 additions and 13 deletions

View file

@ -300,8 +300,8 @@ describe ParagraphConverter do
]
JSON
expected = [
Heading2.new([Text.new("text")] of Child),
Heading3.new([Text.new("text")] of Child),
Heading4.new([Text.new("text")] of Child),
Paragraph.new([Text.new("text")] of Child),
Preformatted.new([Text.new("text")] of Child),
BlockQuote.new([Text.new("text")] of Child), # BQ

View file

@ -109,26 +109,26 @@ describe PageContent do
it "renders an H3" do
page = Page.new(nodes: [
Heading3.new(children: [
Heading2.new(children: [
Text.new(content: "Title!"),
] of Child),
] of Child)
html = PageContent.new(page: page).render_to_string
html.should eq %(<h3>Title!</h3>)
html.should eq %(<h2>Title!</h2>)
end
it "renders an H4" do
page = Page.new(nodes: [
Heading4.new(children: [
Heading3.new(children: [
Text.new(content: "In Conclusion..."),
] of Child),
] of Child)
html = PageContent.new(page: page).render_to_string
html.should eq %(<h4>In Conclusion...</h4>)
html.should eq %(<h3>In Conclusion...</h3>)
end
it "renders an image" do

View file

@ -13,11 +13,11 @@ class ParagraphConverter
when PostResponse::ParagraphType::H3
paragraph = paragraphs.shift
children = MarkupConverter.convert(paragraph.text, paragraph.markups)
node = Heading3.new(children: children)
node = Heading2.new(children: children)
when PostResponse::ParagraphType::H4
paragraph = paragraphs.shift
children = MarkupConverter.convert(paragraph.text, paragraph.markups)
node = Heading4.new(children: children)
node = Heading3.new(children: children)
when PostResponse::ParagraphType::IFRAME
paragraph = paragraphs.shift
if iframe = paragraph.iframe

View file

@ -46,12 +46,12 @@ class PageContent < BaseComponent
figcaption { render_children(node.children) }
end
def render_child(node : Heading3)
h3 { render_children(node.children) }
def render_child(node : Heading2)
h2 { render_children(node.children) }
end
def render_child(node : Heading4)
h4 { render_children(node.children) }
def render_child(node : Heading3)
h3 { render_children(node.children) }
end
def render_child(child : IFrame)

View file

@ -39,10 +39,10 @@ module Nodes
class FigureCaption < Container
end
class Heading3 < Container
class Heading2 < Container
end
class Heading4 < Container
class Heading3 < Container
end
class ListItem < Container