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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87855aadbdb24171b83ced3a1f973439655bbd3b9bd676b378449df3de68bbd2
4
- data.tar.gz: 7ade791de29328f8d9994490d2789d5281995cf18fe6662a32703d8f2b8e46dc
3
+ metadata.gz: 8787bd4fa185e797413467515c62bcd103651592e9ef33a6c6d9afe07f087c5c
4
+ data.tar.gz: e63120ad791f193d3a09711da9345788482ae6076bc8a173d97b863b6273b69f
5
5
  SHA512:
6
- metadata.gz: a8e33edf86e3d9f52c62f046003d69b76f2d6268268c81c0dab3d094ea645e0f9deb6f5e44caa1c0a9a32c5a2d6ad4cbbba5d63f676cdabce17bf37207ec3d76
7
- data.tar.gz: 4712b2d17b3f4955a3d2c43cbaaf4d3c04578539baead870f21f379845e7f3b4d811e1c5cfd72f08de3702f542067a27a66d265fc864305f9be23e783f2ba9b5
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: 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
@@ -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
@@ -8,7 +8,8 @@ module Coradoc
8
8
  def transform_image(image)
9
9
  Coradoc::Markdown::Image.new(
10
10
  src: image.src,
11
- alt: image.alt.to_s
11
+ alt: image.alt.to_s,
12
+ title: image.title
12
13
  )
13
14
  end
14
15
  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.9'
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.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.