diff options
| author | Shulhan <ms@kilabit.info> | 2023-03-02 23:00:07 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-03-02 23:00:19 +0700 |
| commit | 35c7edc6cb26bf63fc8cf1f61d5e33fc9ee620ef (patch) | |
| tree | 17600d2f860187130f23a52c9e603519eaaaa444 /inline_parser.go | |
| parent | 5b83f6228897c3a7f24fa7b60cb30310bb5f2dcf (diff) | |
| download | asciidoctor-go-35c7edc6cb26bf63fc8cf1f61d5e33fc9ee620ef.tar.xz | |
all: ignore parsing block image in paragraph
Previously, if we have block image in paragraph, we parse it as inline
image but with invalid src, for example
image::my.png[multi
line]
would be parsed as <img src=":imy.png" alt="multi line">.
This is incorrect according to asciidoctor output.
Diffstat (limited to 'inline_parser.go')
| -rw-r--r-- | inline_parser.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/inline_parser.go b/inline_parser.go index 621c21e..0e280d7 100644 --- a/inline_parser.go +++ b/inline_parser.go @@ -689,6 +689,13 @@ func parseInlineImage(doc *Document, content []byte) (elImage *element, n int) { lineImage []byte ) + // If the next character is ':' (as in block "image::") mark it as + // invalid inline image, since this is block image that has been + // parsed but invalid (probably missing '[]'). + if content[0] == ':' { + return nil, 0 + } + _, n = indexByteUnescape(content, ']') if n < 0 { return nil, 0 |
