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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d207c747b020fc24b596609a937ae0a4b756295f3e834d925c0ff4af6b403e8f
|
|
4
|
+
data.tar.gz: b1a62c3d3f4df78ef3a0d177cfdf5432f1fe28a1cf24c6716f1da74c00d4122a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
10
|
-
#
|
|
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
|
-
|
|
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
|