Re: A quick experiment with markdown

Yet more. Still not perfect though.
THE IXML

html: head, body.
head: title.
title: +"Markdown".
body: 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]; embedded-html.

-embedded-html: "<", tag, ">", c+, "</", id, ">";
       "<", tag, "/>".
-tag: id, (s, attr)*, s?.
-id: [L]+.
-attr: id, "=", value.
-value: '"', ~['"']*, '"';
        "'", ~['"']*, "'".
-s: " "+.

p: nonstarter, c+.
-nonstarter: ~["#>-*+"; Nd].
blockquote: ">", c+.
ol: (oli, -#a)+.
-oli: d+, -'. ', li.
li: c+.
-d: -[Nd].

ul: (uli, -#a)+.
-uli: -["*-+"], -" ", li.

hr: -"-"+.

pre: "$" . {to do }#

THE MARKDOWN

# A Test

This a <b class="red">paragraph</b>.

---

## Header 2

Another para <hr/>.

1. A list
2. More
3. Yet more


* An unordered list
* And more
* Yet more


The end

THE RESULT

<html>
   <head>
      <title>Markdown</title>
   </head>
   <body>
      <h1>A Test</h1>
      <p>This a &lt;b class="red">paragraph&lt;/b>.</p>
      <hr/>
      <h2>Header 2</h2>
      <p>Another para &lt;hr/>.</p>
      <ol>
         <li>A list</li>
         <li>More</li>
         <li>Yet more</li>
      </ol>
      <ul>
         <li>An unordered list</li>
         <li>And more</li>
         <li>Yet more</li>
      </ul>
      <p>The end</p>
   </body>
</html>

Received on Tuesday, 2 August 2022 17:40:28 UTC