inem / hamdown

[WIP] Next generation template language for fans of Haml and Markdown
MIT License
111 stars 4 forks source link

Add a basic rendering scenario #5

Closed joallard closed 6 years ago

joallard commented 6 years ago

The first step towards a proof on concept is some kind of formal examples.

I thought about what would be a reasonable format to store (hamd -> html) expectation pairs. (1) I want both parts to be in the same file. (2) If I'm going to run these at some point, I don't want to have to code up a custom parser for these files.

Gherkin features allow both parts to be in the same file, and provides ready-made tools so that the glue around those features is easy to get. (Writing these step definitions shouldn't be long; runners already exist.) I would've liked syntax highlighting à la GFM-Markdown code blocks, but alas. (besides, that would've only worked for Html, not Hamdown yet ;o)

inem commented 6 years ago

I personally don't like features. I would probably took different approach. But anyway it is definitely an improvement to the current state of things, so let me merge this!

Btw I stuck for a second under the example with list trying to understand why it renders only 4 and 5, but not 1,2,3. I anticipate a lot of people gonna have problems accepting this behavior :)

joallard commented 6 years ago

Another possibility in my book would have been Yaml files with hamd: / html: pairs, I'll admit the Gherkin format is a little verbose. At the same time, it has some nifty features where you can reuse definitions, and it forces you to document a little. Still, if someone has a better idea and this serves as a starting point, perfect.

Same thing for ambiguous characters (oops, I didn't expect it to become part of the PR!). Starting point, great if someone comes along and improves it.

Cheers!