News for hackers. Stuff that matters.
Re:Typeset.js – A ty­po­graphic pre-proces­sor for HTML by doomrobo on Monday August 17, 2015 @07:47PM (#10076820)
Is 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.
Re:Typeset.js – A ty­po­graphic pre-proces­sor for HTML by dmerfield on Monday August 17, 2015 @07:54PM (#10076847)
Any 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.
Re:Typeset.js – A ty­po­graphic pre-proces­sor for HTML by buymorechuck on Tuesday August 18, 2015 @12:13AM (#10077573)
Back 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.
Re:Typeset.js – A ty­po­graphic pre-proces­sor for HTML by juriansluiman on Tuesday August 18, 2015 @05:51AM (#10078297)
I 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

Re:Typeset.js – A ty­po­graphic pre-proces­sor for HTML by Damin0u on Tuesday August 18, 2015 @01:57PM (#10080906)
For 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

Disclaimer: I'm the author, and I've tested them all.

Re:Typeset.js – A ty­po­graphic pre-proces­sor for HTML by chrisfosterelli on Monday August 17, 2015 @10:20PM (#10077263)
This is great! I wish there was an easy way to incorporate this into Jekyll blogs.
Re:Typeset.js – A ty­po­graphic pre-proces­sor for HTML by nthnclrk on Tuesday August 18, 2015 @12:53AM (#10077652)
Could it not be managed in a Grunt task?
Re:Typeset.js – A ty­po­graphic pre-proces­sor for HTML by chrisfosterelli on Tuesday August 18, 2015 @01:59AM (#10077783)
I 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.

Re:Typeset.js – A ty­po­graphic pre-proces­sor for HTML by teamhappy on Tuesday August 18, 2015 @03:58AM (#10078018)
> 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").

Re:Typeset.js – A ty­po­graphic pre-proces­sor for HTML by snurk on Monday August 17, 2015 @07:01PM (#10076672)
Sweet. 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.

??

Re:Typeset.js – A ty­po­graphic pre-proces­sor for HTML by ultimape on Monday August 17, 2015 @07:39PM (#10076795)
It looks like much of code is some simple routines to find and replace elements. Might not take long to recreate it in pure ruby.
Re:Typeset.js – A ty­po­graphic pre-proces­sor for HTML by Doches on Tuesday August 18, 2015 @10:15AM (#10079275)
Nope, didn't take long at all: https://news.ycombinator.com/item?id=10079270
Re:Typeset.js – A ty­po­graphic pre-proces­sor for HTML by girvo on Monday August 17, 2015 @07:24PM (#10076749)
Rely on stdin/stdout, and call it via backticks?
Re:Typeset.js – A ty­po­graphic pre-proces­sor for HTML by lotyrin on Monday August 17, 2015 @07:54PM (#10076848)
I'd think execjs would be in the running.