Show HN: Preprocessor I've been working 4 years now (npmjs.com)
I'm here today to share with you a software I've been working on for 4 years now. I'm not full time dedicated to it, as I need to make a living. My inspiration to develop it came when I started using Sass for real in production. I really appreciated the hierarchy of nesting rules instead of the way CSS vanilla used to do. The obvious nesting rules was easy to read and understand just by looking at. That was something I personally admirated very much. I wondered why there was no HTML preprocessors as revolutionary as there is for CSS and JavaScript. All popular preprocessors for HTML have one thing in common. All replace the angle brackets by something else (usually identation) and then add some functionalities on top of it. If the symbols for markups are a problem to the experience of developing a visual structure, just replacing it for something else doesn't fix the problem. You are just changing the character of marcation for another.
With that in mind, I started Pretty Markup. Not just replacing the clutter of angle brackets by something else, but removing it completely. Very much inspired by Sass. No special characters needed, except by the quotes. The project still in its early stage, but its already useable. I reached a point where it has a stable base to work. Now, I'm plannig the layer of features that will make it usefull and revolutionary as Sass and TypeScript. Its important to note that I didn't started directly in Pretty Markup. I had a previous package called htmlpp-com-github-mopires. Yes, terrible name, but it was a start. Later a decided to make it more professional and with a friendly name.
You can give it a shot by having NodeJS and installing it with:
npm install pretty-markup
I created a syntax hightlighter for VS Code to attract more devs to it. You can use it by searching "pretty markup" on the extensions tab. Now, it's the first one. The next step will be a package to create a basic starter project. Something like the good old create-react-app.
Any feedback, suggestion or even a contribution about anything is very welcome.
Thank you very much for your attention,
Matheus
PS: The package available in runkit is very old(and I don't know how to update it there), I do not recommend you to test there.
49 comments
[ 1.7 ms ] story [ 106 ms ] threadNatural languages have redundancy because they're often used in cases where transmission is imperfect. The redundancy provides enough information to piece the meaning back together even if the distortion is high.
A similar example of redundancy is the check digit on a credit card number. You could save some space by eliminating it, but then simple human error can cost people a lot of time and money.
The same principle applies to programming languages. They most commonly get distorted through copy/paste and through modification in adjacent code. Sometimes those distortions create a result that is syntactically invalid, which is the best case scenario and gives you a chance to piece it back together. But the more flexible your syntax is and the less redundancy it has, the harder it is to recover from errors. The distorted code can look correct.
Closing tags and curly braces give extra redundancy to a language which can allow for better error recovery in the case of distortion. They're the check digits of programming: they're not exciting or flashy, but they provide a layer of safety to sharing and modification.
The urge to remove delimiters is the lojban impulse [0] applied to programming languages. It's elegant and clean and impractical.
[0] https://mw.lojban.org/index.php
My opinion is that if your answer to a deficiency in the language's syntax is to just test harder you're missing something. Quick feedback loops are essential, and the quickest feedback loop at all is having a syntax where it's immediately obvious to the human looking at the code (before analysis is even run!) when there's a problem.
It'd be even better (in this way at least) if the compiler required they match, but you are also a parser.
I see now that the way I present it is vague. In future post I'll improve the presentation of it.
Thank you for you attetion to detail and for the argument. As humans we are prone to error. With that in mind I think this can be a valuable addition to the markups.
Thank you!
table [...] /table
Seems like maybe all that's different vs. normal HTML is that it doesn't have angle brackets.
Also Pug is more of a templating engine, while this doesn't appear to have any interpolation / templating logic stuff.
The shorthand for classes/IDs seems like a good idea too, if there's a way to do it that improves readability (and seems less magical to the unfamiliar coder)
I'm a fan of higher expressiveness/minimalism, so perhaps I'm just biased in my preference, but I also appreciate how it removes the need to know/care about the inconsistent closing tag semantics of html.
It's a snippet for the post I'll make about this very point.
https://news.ycombinator.com/item?id=41119414