fletcher / MultiMarkdown-4

This project is now deprecated. Please use MultiMarkdown-6 instead!
https://github.com/fletcher/MultiMarkdown-5
Other
306 stars 59 forks source link

Special characters in metadata values/variables #120

Closed mn4367 closed 9 years ago

mn4367 commented 9 years ago

The following document with <, > and & in the metadata section

Author:  John Doe
Position: <Writer, Blogger>
Affiliation: John Wiley & Sons

Lorem ipsum dolor sit amet.

Written by [%Author],\
[%Position] at [%Affiliation].

produces this output (using --escaped-line-breaks):

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="author" content="John Doe"/>
    <meta name="position" content="&lt;Writer, Blogger&gt;"/>
    <meta name="affiliation" content="John Wiley &amp; Sons"/>
</head>
<body>

<p>Lorem ipsum dolor sit amet.</p>

<p>Written by John Doe,<br/>
<Writer, Blogger> at John Wiley & Sons.</p>

</body>
</html>

While the metadata value is correctly escaped in the content-attribute, using the value in a variable leads to invalid HTML which cannot be post-processed with tools which demand well-formed HTML/XML like XSLT.

One remedy when using & is to use

Affiliation: John Wiley &amp; Sons

instead, but that isn't very comfortable. Also this makes it more difficult to use the same document for LaTeX and HTML.

I'd consider this an error, or am I missing something?

Thanks, Michael

fletcher commented 9 years ago

Thanks!