billstclair / elm-html-template

Turn JSON templates and dictionaries into Elm Html
https://lisplog.org/elm-html-template/
MIT License
6 stars 0 forks source link

Make #md more compatible with the spec #17

Closed billstclair closed 7 years ago

billstclair commented 7 years ago

I've been way too fast and loose with the #md syntax. Make it more compatible with:

https://daringfireball.net/projects/markdown/syntax

When I'm done here, the implementation should match [Markdown.md (../blob/master/Markdown.md).

TODO

The reference style of specifying URLs separate from their uses would also be nice, but is not high priority.

Done

Need to devise some way to specify the classes of all the Html elements created by Markdown expansion.

Class specifications can come before the top-level types, e.g. table, list, blockquote, preformat.

{ table: <table-class>
, tr: <tr-class>
}

Entities. At least &nbsp; and &copy;. Also numeric entities, e.g. &#48; and &#x30 both represent "0".

Automatic links surrounded as \http://example.com and \user@host.com would be nice. I will NOT pattern match on URLs.

Horizontal rules should be easy. Add them.

Tables would be nice, as done by GitHub.

Blockquotes.

In particular, use backslash for escaping, not doubling the characters.

Some way of escaping JSON, perhaps double square brackets:

1 + 2 = [["#+",1,2]]

Headers: #, ##, ###, etc. at the beginning of the line.

Do NOT support underlines under a header. Do matching #s at end of header line, if it's easy. (it was easy, so I did it)

Add (optional) titles to links and images:

[example](http://url.com/ "Title")
![alt text](/path/img.jpg "Title")

_foo_ or *foo* becomes foo   [=done=] __foo__ or **foo** becomes foo   [=done=]

A leading * or _ does nothing if followed by whitespace.   [=done=] A trailing * or _ does nothing if preceded by whitespace.   [=done=]

I've always hated having to double the characters to get bold, but that's the spec.   [=done=]

Double-newline must convert to paragraph tags of the paragraphs before and after.   [=done=]

" \n", newline preceded by at least two spaces, is <br/>. Do I need to support <br>, <br/>, and <br /> as well? It'd rather not. Github doesn't require the preceding spaces. That's what I'm doing now. I'm going to change it to Gruber's way, requiring two or more spaces before a newline to generate a line-break. This is more natural for non-programmers.   [=done=]

Need to implement multiple backtick for codeblocks. Probably do NOT need to implement 4-space indent for codeblocks, though real markup converts the latter to <pre><code>...</code></pre> and the former to <code>...</code>. I think I'll just wrap <pre>...</pre> around any multi-line code block. Also need to use <pre>...</pre> INSTEAD of <p>...</p>.   [=done=]

Need lists, and nested lists.   [=done=]

billstclair commented 7 years ago

I looked at the evancz/elm-markdown package, in the hopes that I could just change its output, but it is a thin wrapper around the Virtual DOM JavaScript code.

billstclair commented 7 years ago

I made new enhancement tickets to replace the bits of Markdown I decided not to do at this time.

20 Reference-style URLs in Markdown

21 Setext-Style Headers in Markdown

Nothing left to do here. Closed.