coradoc-markdown 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87855aadbdb24171b83ced3a1f973439655bbd3b9bd676b378449df3de68bbd2
4
- data.tar.gz: 7ade791de29328f8d9994490d2789d5281995cf18fe6662a32703d8f2b8e46dc
3
+ metadata.gz: d207c747b020fc24b596609a937ae0a4b756295f3e834d925c0ff4af6b403e8f
4
+ data.tar.gz: b1a62c3d3f4df78ef3a0d177cfdf5432f1fe28a1cf24c6716f1da74c00d4122a
5
5
  SHA512:
6
- metadata.gz: a8e33edf86e3d9f52c62f046003d69b76f2d6268268c81c0dab3d094ea645e0f9deb6f5e44caa1c0a9a32c5a2d6ad4cbbba5d63f676cdabce17bf37207ec3d76
7
- data.tar.gz: 4712b2d17b3f4955a3d2c43cbaaf4d3c04578539baead870f21f379845e7f3b4d811e1c5cfd72f08de3702f542067a27a66d265fc864305f9be23e783f2ba9b5
6
+ metadata.gz: 6842c914db9bfa787cc93e9f4b197e010bd303fc7da0687b49e5d8b025dae06c6376a12f8b6f98fd76617b1224db22766883a18a5fd423d7829e690f45337b3f
7
+ data.tar.gz: 16c27e25254e057943c8505b6ef493dd48aa5280d8d9581ccf8aa106e06fa1524522a86ba56ed31be5e90c9e5adf3b497eed30cad47665d2871f99e8769e30e3
@@ -6,13 +6,22 @@ module Coradoc
6
6
  module Markdown
7
7
  class Serializer
8
8
  module Serializers
9
- # Pass block: emit content inside kramdown's nomarkdown extension
10
- # so it bypasses Markdown rendering.
9
+ # Pass block. AsciiDoc pass content is raw and bypasses all
10
+ # substitutions. Markdown has no equivalent — kramdown's
11
+ # `{::nomarkdown}` extension is not supported by VitePress /
12
+ # markdown-it, so emitting it leaks raw HTML that breaks Vue's
13
+ # template compiler.
14
+ #
15
+ # Emit as an HTML comment so the content is preserved (for
16
+ # debugging or downstream tooling) but never rendered as HTML.
11
17
  class Pass < ElementSerializer
12
18
  handles_type ::Coradoc::Markdown::Pass
13
19
 
14
20
  def call(element, _ctx)
15
- "{::nomarkdown}#{element.content.to_s}{:/}"
21
+ content = element.content.to_s
22
+ stripped = content.gsub(/\A\n+|\n+\z/, '')
23
+ comment_body = stripped.empty? ? '' : " #{stripped} "
24
+ "<!--#{comment_body}-->"
16
25
  end
17
26
  end
18
27
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'cgi'
4
+
3
5
  module Coradoc
4
6
  module Markdown
5
7
  module Transform
@@ -417,6 +419,8 @@ module Coradoc
417
419
  text: element.content.to_s,
418
420
  target: element.target.to_s
419
421
  )
422
+ when 'raw_inline'
423
+ CGI.escapeHTML(element.content.to_s)
420
424
  else
421
425
  element.content.to_s
422
426
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'cgi'
4
+
3
5
  module Coradoc
4
6
  module Markdown
5
7
  module Transform
@@ -38,7 +40,7 @@ module Coradoc
38
40
  target: element.target.to_s
39
41
  )
40
42
  when 'raw_inline'
41
- element.content.to_s
43
+ CGI.escapeHTML(element.content.to_s)
42
44
  else
43
45
  element.content.to_s
44
46
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Coradoc
4
4
  module Markdown
5
- VERSION = '1.0.7'
5
+ VERSION = '1.0.8'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coradoc-markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.