4 ms·
Typeset.js – A typographic pre-processor for HTML
- snurk 11y agoSweet. I've been doing this in Rails helpers, and it's a pain. Now, how would I add this to my Rails asset pipeline? I'm thinking either: * Port to Ruby, or * Use this as a microservice. ??
- girvo 11y agoRely on stdin/stdout, and call it via backticks?
- ultimape 11y agoIt looks like much of code is some simple routines to find and replace elements. Might not take long to recreate it in pure ruby.
- Doches 11y agoNope, didn't take long at all: https://news.ycombinator.com/item?id=10079270 https://news.ycombinator.com/item?id=10079270
- lotyrin 11y agoI'd think execjs would be in the running.
- doomrobo 11y agoIs small cap conversion done for every word that's written in all capitals? The convention that I'm familiar with (I think from The Elements of Typographical Style) is to only set acronyms - that is, pronounceable initialisms like "NASA" or "PETA" - in small caps. All other initialisms like FBI or USA are set as normal-sized caps. I think the reasoning is that small caps are there to preserve the capitals but not disturb the flow of the text, since it's read as a word just like the words around it. Full caps do disturb the flow of the text because they are not words and not pronounced as words either.
- dmerfield 11y agoAny word in all-caps is 'converted' to small-caps. This behaviour can be changed, or even disabled, by setting a flag in the options object before processing. I prefer to keep all-caps out of my body text.
- buymorechuck 11y agoBack at Flipboard, for our RSS typography processing, we used a rule of thumb that all-capped words 3 letters or longer would get small-caps treatment. It worked pretty well.
- juriansluiman 11y agoI have used a similar tool [1] some time ago in PHP. The project hasn't been kept updated, but the idea of processing text/HTML and converting the right entities is pretty neat. At least the readability improves massively. This project Typeset.js is slightly different as it adds additional markup and styles. For me, converting here's to here’s was enough for me back then. [1]: https://github.com/scoates/lexentity https://github.com/scoates/lexentity
- Damin0u 11y agoFor PHP you can have a look at JoliTypo [1], much more up to date, tested, working for any style guide and using a real parser. [1]: https://github.com/jolicode/jolitypo https://github.com/jolicode/jolitypo Disclaimer: I'm the author, and I've tested them all.
- chrisfosterelli 11y agoThis is great! I wish there was an easy way to incorporate this into Jekyll blogs.
- nthnclrk 11y agoCould it not be managed in a Grunt task?
- chrisfosterelli 11y agoI suppose you could write a grunt or gulp task to parse all of the files after jekyll has generated them and run them through typeset. It might be slightly challenging to ensure that only the actual article content gets ran through typeset and not any other content. Unfortunately, I use Github pages so this wouldn't work for that from what I can tell.
- teamhappy 11y ago> It might be slightly challenging to ensure that only the actual article content gets ran through typeset and not any other content. Not a problem. It accepts CSS selectors as options (e.g., ".article").