Class: Coradoc::Markdown::Serializer::Serializers::Pass

Inherits:
ElementSerializer show all
Defined in:
lib/coradoc/markdown/serializer/serializers/pass.rb

Overview

Pass block. AsciiDoc pass content is raw and bypasses all substitutions. Markdown has no equivalent — kramdown’s ‘nomarkdown` extension is not supported by VitePress / markdown-it, so emitting it leaks raw HTML that breaks Vue’s template compiler.

Emit as an HTML comment so the content is preserved (for debugging or downstream tooling) but never rendered as HTML.

Instance Method Summary collapse

Methods inherited from ElementSerializer

call, handles?, #handles?, handles_type, #handles_type

Instance Method Details

#call(element, _ctx) ⇒ Object



20
21
22
23
24
25
# File 'lib/coradoc/markdown/serializer/serializers/pass.rb', line 20

def call(element, _ctx)
  content = element.content.to_s
  stripped = content.gsub(/\A\n+|\n+\z/, '')
  comment_body = stripped.empty? ? '' : " #{stripped} "
  "<!--#{comment_body}-->"
end