Skip to content

Instantly share code, notes, and snippets.

@alexyoung
Created July 25, 2011 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexyoung/82c32f0e742505e90d2a to your computer and use it in GitHub Desktop.
Save alexyoung/82c32f0e742505e90d2a to your computer and use it in GitHub Desktop.
Idea

Goals for a lightweight markup language (LML?)

  • Embrace CSS selectors
  • Trivial to parse
  • Easy to learn
  • Consistent
  • Optimised for writers
  • BNF spec

Combining ideas from Jade, Markdown, and Textile.

Tags

Support any tag with simple replacement, inspired by Jade, using this format:

tag.className(attr1="value", attr2="value")[optional innerHTML]
tag(defaultOption)[optional innerHTML]
tag[innerHTML]
tag#id

Examples:

a.className(href="http://example.com")[This is a link]
h3[This is a header]
code[Here is some code]
bq[This is a block quote]

Inline Tags

Strong/emphasis:

*text*
_text_

Lists

Unordered:

* Item 1
* Item 2
* Item 3

Ordered:

# Item 1
# Item 2
# Item 3

Optimised for Writers

Link shorthand:

a(http://)[Link text]

One parameter implies 'href'.

And, omission of 'a' should be supported too:

(http://)[Link text]

Parsing Notes

  • Brackets can be escaped
  • Lines that don't match are paragraphs
  • Preformatted is escaped
  • Spans, tables: not supported (why bother if the lightweight markup is harder to read than the original HTML?)
@onlymejosh
Copy link

Not keen on the headers
I like the markdown approach with #

Maybe something like

.className Header 1

Not sure how that would work for id's though

I like it the code blocks and block quotes though.

@alexyoung
Copy link
Author

I thought being strict and just using tag names might make it easier to parse. I better add an #id example too...

@jcolebrand
Copy link

if omission of a is supported, then why require the a at all? Just remove that "feature"

@alexyoung
Copy link
Author

I thought it was a consequence of anything being able to be a tag that's in the form [a-zA-Z][a-zA-Z0-9]+\(...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment