Class: Chiridion::Engine::PostProcessor
- Inherits:
-
Object
- Object
- Chiridion::Engine::PostProcessor
- Defined in:
- lib/chiridion/engine/post_processor.rb
Overview
Post-processes rendered markdown for consistent formatting.
Handles normalization that’s easier to do as a final pass rather than trying to get perfect output from templates. May grow into fuller linting/validation over time.
Current normalizations:
-
Collapse multiple consecutive newlines to single newlines
-
Ensure 2 newlines before horizontal rules (—)
-
Preserve frontmatter formatting
Class Method Summary collapse
-
.process(content) ⇒ String
Normalize markdown content.
Instance Method Summary collapse
-
#process(content) ⇒ String
Normalized content.
Class Method Details
.process(content) ⇒ String
Normalize markdown content.
20 21 22 |
# File 'lib/chiridion/engine/post_processor.rb', line 20 def self.process(content) new.process(content) end |
Instance Method Details
#process(content) ⇒ String
Returns Normalized content.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/chiridion/engine/post_processor.rb', line 26 def process(content) # Split off frontmatter to preserve it exactly frontmatter, body = split_frontmatter(content) # Normalize the body normalized = normalize_newlines(body) # Reassemble frontmatter ? "#{frontmatter}\n\n#{normalized}" : normalized end |