Show HN: New markup language for fans of Haml and Markdown
github.com
github.com
The opening example in Hamdown's readme would look like this in Textile:
h1. Main Title
h2(f2 helvetica strike). Fancy title *with some bold*
Some content
I used to prefer Textile to Markdown (and I ran a web site using Textpattern, the CMS designed by Textile's creator, which still has one of the nicer template languages and plugin systems of any system I've used). I eventually gave up and joined the Markdown crowd, and I'm generally happy with it, but in some ways Textile is still superior. It has some aspects of Haml's "HTML but simpler" approach, but Textile still reads more like, well, text in a way that (at least to me) Haml mostly doesn't.That suggests Hamdown might also be too middle ground, although it'd be more familiar to folks who are already Haml fans. Personally I always found Haml a little off-putting, but I have absolutely no good reason why.
%DIV sidebar%
##Interesting fact##
This fact it tangentially related
to the __content__ and will appear
in a sidebar.
%ENDDIV%
Which throws the <div class="sidebar"> .. </div> around the content. Basically by slurping it through the toolkit first, then markdown second.It is still clunky and I always have to load all the perl dependencies after I do a significant upgrade to me dev machine but so far it works.
I'll try to keep an eye on it.
MarkHAML
The nice thing about Markdown is that the source file is just as readable as the output. Haml and hamdown fail at this. If I'm gonna have a computer parse "%h2.f2.helvetica.strike" for me, it might as well handle an entire HTML document.
Think of Markdown as a WYSIWYG format. The plaintext is the document, but there just happen to exist tools for automatically displaying it as HTML too. If something looks wrong as plaintext Markdown, you're doing Markdown wrong.
But in this case:
<h2 class=“f2 helvetica strike”>Fancy title <strong>with some bold</strong></h2>
Tachyons really seems to have reinvented the <font> tag. Like, exactly. Come on guys.Edit: Apparently I'm out of the loop, and this style (atomic css) is now good. I'll take this as an opportunity to learn to refrain from making snide comments about fields I am not deeply involved in
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fo...
That being said, apparently I'm wrong and this style is back in vogue. CSS Zen garden style design has just failed hard apparently, so this is how things are done.
HAML uses CSS-like syntax to allow you to write HTML more succinctly: %div.foo.bar means <div class="foo bar">, for example. It has tons of short of concise syntax to make it a more pleasant alternative to HTML. It uses whitespace-sensitive indentation, like Python, so no end tags.
This isn't reinventing the font tag. It's an alternative to putting HTML in Markdown, which many people do because Markdown is very limited. Sometimes you need to insert something that isn't supported.
Not saying this is good, just explaining how your criticism doesn't apply.
I'm saying that to help apply a principle of charity when evaluating this idea that on first blush looks like insanity. But there is something in there.
Readings to get started: https://johnpolacek.github.io/the-case-for-atomic-css/
https://mdgriffith.gitbooks.io/style-elements/content/
Accessibility is often mentioned when it comes to the separation of concerns between HTML layout and CSS layout, but why would somebody try to adress blind people differently when it comes to semantics and hierachy? Wouldn't you want the same experience as seeing people?
The niche is rather narrow - it is for people who use static site generators like Jekyll/Middleman, and write content mostly in Markdown.
I often simply want to do a quick look-and-feel experiment by styling some of the elements with Tachyons. This is where Markdown becomes a bottleneck.
Another idea is to make front-matter a first class citizen of Hamdown so that you could add a bit of structured data on top of your blog post and use on the page.
P.S. You kinda can achieve this with kramdown, but I find its syntax super-weird.
Writing HTML or markup using something like Haml or Pug is just so much more enjoyable than using raw HTML/XML. The structure is forcibly clearer and you simply type less. I know some who like Emmet, but this is so much better than that. It's too bad that sometimes it isn't an option! =(
Awaiting the 30 responses to implementations that already have this...
%h2.f2.helvetica.strike
The first period denotes a tag on the left and a class attribute on the right, but the other periods just denote sibling classes. They don't parse into the same syntax, and my instinct is to read it as (h2 (f2 (helvetica (strike))) but that's not what's happening.And adding significant whitespace to Markdown and everything else to me just serves to obfuscate and abstract away the one thing I most want in a markup language that emits HTML, which is to easily visualize the tree and the markup.
Great idea though.
Deleted comment
`##### test` for example is not as efficient and easy to read as `#5 test`.
Takashi recommends to take a look at these gems: - https://github.com/judofyr/temple - https://github.com/eagletmt/haml_parser
"I have this great idea. buy it here!" oh really we haven't implemented anything, but now that we see a bunch of people tried to buy it...
I'm fine with the idea of running ideas past the community here, but this really feels like a bait and switch. It's not a new markup language. It's a new IDEA for a markup language.
I much prefer HTML and erb.
Web development is complex enough (server side, js, css) without adding an abstraction layer to your markup too.
The problem with HTML is it’s verbose. So folks like to save some keystrokes (and mistakes).
All the "plain text" formatting languages tend to break down. They work until they don't and then somebody invents yet another text-based pseudo-markup language. Asciidoc is best of the worst but fundamentally it's a bad idea. If you're willing to make the investment in tools and training there's a lot of value in enabling people to write real HTML (and MathML) or, better, Docbook + domain-relevant XML that produces real UI-agnostic structured information.
The problem here is that the tools are terrible or expensive or bloated. There's no reason why this should be the case and it's likely a real market opportunity.
The spec for Markdown's syntax includes HTML in its entirety, though...
Then I found slim. It eliminates most of the markup, reducing it to its humanly readable essence, producing clean well-formed html.
Writing, and more importantly, reading only the meaningful part of the markup has helped my productivity skyrocket.
My eyes don’t have to struggle to figure out the document structure.
For me, typing full html is no longer an option. Even with emmet I’d have to read it, multiple times, with all the markup syntax poking my eyes.
Slim has been around for years, steadily improving and addressing corner cases.
I absolutely love it. Reduces typing by 50%, reading by 1000+%(as I re-read the code multiple times and it eliminates the multiple takes and looking for closing tags) and matches how my human brain thinks about markup.
Pug (actually Jade at the time) v0.1: Jul 5, 2010
I'm thinking these are "convergent evolution", especially since they arose in different language communities.
I totally agree that this is the best way to generate HTML. I use pug even for really tiny pages and templates. It amazes me that people like JSX, which seems like a total regression from building elements with function calls like React originally had. When I code Cycle.js in coffeescript it looks and feels a lot like pug; which is great.
> I prefer just vanilla javascript, css, and html. They work fine, no bloated frameworks!
> What do you do for templates?
> Oh you just pipe it through a really simple shell script I devised. It's just a few lines
> ಠ_ಠ
Haml is almost the complete opposite IMO, since reading a document formatted with Haml does not result in elegant plain text, and it's not designed specifically for simple use cases.
This mixture of the two really irks me, as a result.
For example, you can say in SGML that the character '-' at the begin of a line when appearing below a particular parent element should start a line item, using a SGML shortref map/use declaration.
Blends particularly well with markdown eg. where in regular markdown you can use literal HTML, in markown+SGML you can make use of full SGML.
Hamdown idea is to enable automated content-generation by allowing ruby code embedding (like you can do with HAML)