Conversion to HTML, snippet option, how to preserve DOCTYPE and closing body + HTML in transcluded sections?

mpost's Avatar

mpost

31 Jul, 2017 08:08 PM

Hello Fletcher,

let me first say that MultiMarkdown is the greatest thing since sliced bread. I’m recommending it to absolutely everyone, I bought MultiMarkdown Composer and I‘d buy the t-shirt, too if there were one. :)

Now here’s a problem I can’t solve on my own (but I realize it may simply not be doable without post-processing). I have a (simplified test) file “Transclusion_Test.md” with transclusions like this:

---
Title: Transclusion test

{{Transclusion_Test_header.md}}
{{Transclusion_Test_content.md}}
{{Transclusion_Test_footer.md}}
---

“Transclusion_Test_header.md” contains:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>[%Title]</title>
</head>
<body>
<div>

“Transclusion_Test_footer.md” contains:

</div>
</body>
</html>

Now when converting this in snippets mode in MMD 5.4 (as part of Bryan Jones’ CodeKit), the transcluded header’s content comes out as:

<p>&lt;!DOCTYPE html&gt;
<html>
<head>
<meta charset="utf-8">
<title>Transclusion test</title>
</head>
<body></p>

I.e., it is wrapped in <p></p> tags and the DOCTYPE tag gets converted.

For the transcluded footer, closing body and HTML tags get wrapped in paragraph tags, too:

</div>
<p></body>
</html></p>

In MultiMarkdown 6.1, the second problem is resolved, but the &lt;!DOCTYPE html&gt; issue remains.

For this particular project, I need to have full control over HTML structure, that’s why I’m using the snippets option.

Any way to avoid this problem – i.e., have MMD preserve the <!DOCTYPE html> and </body></html> tags as such?

Thank you!

  1. Support Staff 1 Posted by fletcher on 31 Jul, 2017 11:02 PM

    fletcher's Avatar

    I'm glad MMD has been helpful for you, and thanks for the support!!

    In v5, you could try using the old raw text syntax, which is to use an html comment -- <!--foo-->.

    But better is to use v6, and use the new syntax for including raw text, as discussed here. You can combine either with transclusion.

    Hope this helps!!!

    Fletcher

  2. fletcher closed this discussion on 31 Jul, 2017 11:02 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac