coradoc-markdown 1.0.7 → 1.0.9
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 +4 -4
- data/lib/coradoc/markdown/serializer/serializers/pass.rb +12 -3
- data/lib/coradoc/markdown/transform/from_core_model.rb +6 -1
- data/lib/coradoc/markdown/transform/image_transformer.rb +2 -1
- data/lib/coradoc/markdown/transform/inline_transformer.rb +3 -1
- data/lib/coradoc/markdown/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8787bd4fa185e797413467515c62bcd103651592e9ef33a6c6d9afe07f087c5c
|
|
4
|
+
data.tar.gz: e63120ad791f193d3a09711da9345788482ae6076bc8a173d97b863b6273b69f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 707ffce48956d79723b12c6112ff9237f5149037f830f37b32ad2905e6ea1ad8b0456d888ce7d4cf74315d54e9e4fab37287e44cb7d38d363318bae9f13d8a25
|
|
7
|
+
data.tar.gz: 5ef6ac646dac9047440649ad153e0bbd8300caa29633c8b41e1bcf58c09e5eee034a2aec0e63be3e4c4d5c423dca02a488d6f9912711f576f9a9d8288b3b4541
|
|
@@ -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
|
|
@@ -381,7 +383,8 @@ module Coradoc
|
|
|
381
383
|
def transform_image(image)
|
|
382
384
|
Coradoc::Markdown::Image.new(
|
|
383
385
|
src: image.src,
|
|
384
|
-
alt: image.alt.to_s
|
|
386
|
+
alt: image.alt.to_s,
|
|
387
|
+
title: image.title
|
|
385
388
|
)
|
|
386
389
|
end
|
|
387
390
|
|
|
@@ -417,6 +420,8 @@ module Coradoc
|
|
|
417
420
|
text: element.content.to_s,
|
|
418
421
|
target: element.target.to_s
|
|
419
422
|
)
|
|
423
|
+
when 'raw_inline'
|
|
424
|
+
CGI.escapeHTML(element.content.to_s)
|
|
420
425
|
else
|
|
421
426
|
element.content.to_s
|
|
422
427
|
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
|