Browse Source

Show inline `code` content in image `alt` tag #1142

pull/1197/head
Vitaly Puzrin 2 months ago
parent
commit
54289c4d99
  1. 2
      src/renderer.ts
  2. 8
      test/fixtures/markdown-it/commonmark_extras.txt

2
src/renderer.ts

@ -306,6 +306,8 @@ class Renderer {
for (let i = 0, len = tokens.length; i < len; i++) {
switch (tokens[i].type) {
case 'text':
case 'code_inline':
// code content is added as plain text, without backticks
result += tokens[i].content
break
case 'image':

8
test/fixtures/markdown-it/commonmark_extras.txt

@ -742,6 +742,14 @@ Html in image description
.
Code in image description (#1142)
.
![foo *bar* `baz` bla](image.png)
.
<p><img src="image.png" alt="foo bar baz bla"></p>
.
https://github.com/commonmark/commonmark.js/pull/279
.

Loading…
Cancel
Save