Class: Marcdouane::Rules::StartWithTopLevelHeader
- Defined in:
- lib/marcdouane/rules/start_with_top_level_header.rb
Overview
Ensure the first line, frontmatter or not, is a top-level header.
Constant Summary collapse
- ERROR_MESSAGE =
"The file should start with a top-level header"
Instance Attribute Summary
Attributes inherited from Rule
Instance Method Summary collapse
Methods inherited from Rule
#error!, #identifier, #initialize, #line_number_from_byte_range
Constructor Details
This class inherits a constructor from Marcdouane::Rules::Rule
Instance Method Details
#check! ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/marcdouane/rules/start_with_top_level_header.rb', line 10 def check! sections = @markdown.chunks_by_heading if sections.empty? || sections.first[:level] != 1 error!(0) end end |