- From: Steven Pemberton <steven.pemberton@cwi.nl>
- Date: Mon, 01 Aug 2022 19:32:19 +0000
- To: ixml <public-ixml@w3.org>
Following on from this [evening]'s discussion about parsing markdown, here
is a quick incomplete try with embedded html
THE IXML
markdown: (section, #a)+.
-section: (h1; h2; h3; h4; h5; h6; p; blockquote; ol; ul; pre; hr), #a.
h1: -"#", ~["#"], ~["#"], ~["#"], ~["#"], ~["#"], text.
h2: -"##", ~["#"], ~["#"], ~["#"], ~["#"], text.
h3: -"###", ~["#"], ~["#"], ~["#"], text.
h4: -"####", ~["#"], ~["#"], text.
h5: -"#####", ~["#"], text.
h6: -"######", text.
-text: c+.
-c: ~["<"; #a]; html.
-html: "<", tag, ">", c+, "</", id, ">".
-tag: id, (s, attr)*, s?.
-id: [L]+.
-attr: id, "=", value.
-value: '"', ~['"']*, '"';
"'", ~['"']*, "'".
-s: " "+.
p: nonstarter, c+.
-nonstarter: ~["#>-"; Nd].
blockquote: ">", c+.
ol: li+.
li: d+, '.', c+.
-d: [Nd].
ul: "@" . {todo}
hr: -"-"+.
pre: "$" . {to do }#
THE MARKDOWN
# A Test
This a <b class="red">paragraph</b>.
---
## Header 2
THE OUTPUT
<markdown>
<h1> A Test</h1>
<p>This a <b class="red">paragraph</b>.</p>
<hr/>
<h2> Header 2</h2>
</markdown>
END
Received on Monday, 1 August 2022 19:32:36 UTC