lruiz/MarkdownPapers

<img src="http://..."> tag causes parser error

Closed this issue · 5 comments

Hi,

I tried some markdown processors and all parsed img-tags properly. But somehow, I got a Parser exception because the parser wouldn't accept the ":" from "http://"

example:
(edit: uhm ... this editor directly replaces the <img ... with the image, so it obviously is valid in Markdown) ... but you certainly understand what I mean ...

caused:
Exception in thread "main" org.tautua.markdownpapers.parser.ParseException: Encountered " ":" ": "" at line 32, column 14.
Was expecting one of:
......

Thx in advance for helping me here

All the best,
Thomas

hi, which version are you using?

Try it with version 1.2.2

Does v1.2.2 solve the problem?

Hi,

sorry for the late answer.

I setup a new clean java project and it doesn't produce a parser error anymore.

But strangely, it just replaces > with > and doesn't process any markdown elements, so clearly, something went wrong.

I used the latest 1.2.2 jar.

Is it possible to attach some code here?

Thomas

Ah okay, I figured out what went wrong ...

I tried to use my < img > tag again and the processor was confused about not having < /img > at the end of the image. So, it seems to depend on valid xhtml? This would certainly be a problem for all ...

There also were blockquotes within the markdown text > and it got even more confused ... It stopped processing markdown at all and just did html escaping

Sample:

<img src="http://avatars.ravelrycache.com/Nene/3995496/DieWeihnachtswaesche_large.jpg">
Using this tool
---------------
This page lets you create HTML by entering text in a simple format that's easy to read and write.
  - Type Markdown text in the left window
  - See the HTML in the right
Markdown is a lightweight markup language based on the formatting conventions that people naturally use in email.:
> The overriding design goal for Markdown's
> or formatting instructions.

output:

<img src="http://avatars.ravelrycache.com/Nene/3995496/DieWeihnachtswaesche_large.jpg">

Using this tool
---------------

This page lets you create HTML by entering text in a simple format that's easy to read and write.

  - Type Markdown text in the left window
  - See the HTML in the right

Markdown is a lightweight markup language based on the formatting conventions that people naturally use in email.:

&gt; The overriding design goal for Markdown's
&gt; or formatting instructions.
</img>

The problem on this behaviour is that noone will ever use clean xhtml when using tags ...

Thomas

In fact markdown can handle images perfectly, the same for <hr> and <br>.

for example:

 <img src="http://avatars.ravelrycache.com/Nene/3995496/DieWeihnachtswaesche_large.jpg"> 

could be written in markdown as

 ![alt](http://avatars.ravelrycache.com/Nene/3995496/DieWeihnachtswaesche_large.jpg

But I got your point here, some implementations can handle tags no properly closed and others only handle well formed tags(perhaps that maintains the simplicity of the parser), I think some sort of documentation that explains the syntax that markdownpapers follows should help.