HNHacker News
TopNewBestAskShowJobs

kaushalmodi

353 karma · joined July 12, 2016

Loves Emacs and command-line utilities. You can find me by the same username on GitHub, Gitlab, reddit and Twitter.

Blog: https://scripter.co

* Few projects:

- Org-mode + Hugo: https://ox-hugo.scripter.co

- Eless (A Better less): https://eless.scripter.co

submissionscomments
kaushalmodi··on Show HN: LayerJS – A simple UI composition and navigation library
I would have loved to try it, but it looks a bit too heavy (.js size, even minified is 30KB+, and looks like jquery is needed too?) foe my 197KB homepage, and I am actually working to trim off few dozen KBs by not depending on jquery slim.
kaushalmodi··on All You Need to Know About UML Diagrams
I have started using PlantUML[1] quite a bit recently in my blogging (one example[2]). I have PlantUML code in Org mode source blocks, and Org Babel then generates the svg/png of the diagram each time I update the code block.

[1]: http://plantuml.com/ [2]: https://scripter.co/org-contribution-flowchart/#flow-chart

kaushalmodi··on A more privacy-friendly blog
I fixed this finally, thanks to Github user dpvc and his suggested way of writing MathJax config: https://github.com/mathjax/MathJax/issues/1988#issuecomment-....
kaushalmodi··on A more privacy-friendly blog
Thanks to your post, I learnt about Content-Security-Policy in HTTP headers. I thought, that's awesome, let me add a tight CSP to my site (https://scripter.co) as I don't load any content from outside and the only thing going out are Webmentions sending requests... and then I realize that I use #mathjax on some pages..

MathJax requires me to add 'unsafe-inline' and 'unsafe-eval' to script-src, and 'unsafe-inline' style-src. So my overall CSP becomes quite weak :(

Anyone would have an idea how to implement CSP without those, and uses MathJax?

Thanks.

kaushalmodi··on Golang Quirk: Number-strings starting with “0” are Octals
Follow-up post: https://scripter.co/follow-up-golang-quirk-number-strings-st...
kaushalmodi··on Golang Quirk: Number-strings starting with “0” are Octals
That's a valid point. I have made that suggestion to the Hugo devs[1]. Someone on Reddit also suggested using strconv.Atoi() instead of ParseInt(). I have added to the suggestion too.

[1]: https://github.com/gohugoio/hugo/issues/4628#issuecomment-38...

kaushalmodi··on Golang Quirk: Number-strings starting with “0” are Octals
Thanks for your comment. It kind of makes a little sense now. I just wished the octals needed a stricter prefix like "0o" as they are not very common compared to decimal and hex (in my experience at least). The way Python casts strings with leading zeros makes more sense to me. Later I'll update the post with your feedback. Thanks.
kaushalmodi··on Twitter is down
Right, I would love to read such posts with the forensics on what happened. But just 3-word phrase titled "posts" with zero-content should be discouraged from floating to the HN front-page.. otherwise this would be just another "reddit".
kaushalmodi··on Twitter is down
And this news is HN worthy?
kaushalmodi··on Show HN: Glyph – Static Site Generator Powered by GitHub Issues and Pages
The linked issue is probably useful if someone using Emacs/Org exports Org to Markdown format, and then uploads to a Github issue as that feature proposes. But then I fail to see the advantage of that flow vs just committing the Markdown file to any online git repo and letting Netlify etc. take care of publishing the blog.

Because.. uploading a Markdown file to a Github issue is one thing, but then what about refactoring, occasional post edits, etc.? Probably keep on overwriting the same Github issue with updated Markdown files?

You don't have to reply to these questions here.. just some thought if you do invest time in implementing this feature request.

kaushalmodi··on Build a JSON API with Hugo's Custom Output Formats
Hugo's custom output formats are powerful. It ships with just inbuild RSS xml generation (in addition to HTML of course). But it is very easy to add ATOM xml too.

And another custom output format to dump search index in JSON for the whole site (to be used by sorts of fuse.js, lunr.js, etc.)

kaushalmodi··on Show HN: Glyph – Static Site Generator Powered by GitHub Issues and Pages
No worries, I wasn't suggesting that you support that. I have a very well established blogging flow and I don't have any reason to move away from it. I just happened to come across this HN post, and found your project interesting.
kaushalmodi··on Show HN: A module to color console messages || NodeJs
"yeah boi" That's one good reason why I wouldn't even try this package.
kaushalmodi··on Hugo or Jekyll? 6 Factors You Should Know
The TL;DR looks incorrect! It's Hugo that's beginner friendly, not Jekyll. I had tried Jekyll and Octopress in the past (many years ago) and gave up on static site generation after I couldn't get the Ruby dependency hell to get installed. With Hugo, I had my site running within an hour.

Along the same lines, I found the Go templating language very natural to pick up, probably because I am a Lisp afficionado.

And lastly, you have a typo in the list of markup languages supported for content; Mark -> MMark. And you missed out Org mode in that list.

kaushalmodi··on Show HN: Glyph – Static Site Generator Powered by GitHub Issues and Pages
Thanks for sharing.

For those who might be wondering, using OP's GitHub repo as example, the first post in the issue thread[1] gets converted to a blog post[2].

That's pretty cool! Though, it will be tough to pry myself away from my blogging flow that uses Org mode as content source and uses all of the Org+Emacs functionality :)

[1]: https://github.com/dbriemann/blog/issues/2 [2]: https://dbriemann.github.io/blog/2-introducing-glyph-static-...

kaushalmodi··on Medium suspended our account and blocked access to all our published stories
If someone is writing a programming blog AND using a static site generator like Hugo, etc., that also builds up the author's credibility as a programmer in my view. But that's just me.
kaushalmodi··on Show HN: Makesite – A static site generator in 125 lines of Python
I'm not very (I mean, at all) conversant with Javascript. So stuff like Gulp, Grunt, etc is outside my comfort zone. But one fine day, someone posts step-by-step tutorial[1] on how to set up static site search using Fuse.js on Hugo sites without Gulp, Grunt, etc., and I am finally able to set up search[2] on my Hugo generated blog in no time.

[1]: https://discourse.gohugo.io/t/site-search-implemented-using-... [2]: https://scripter.co/search/

kaushalmodi··on Show HN: Makesite – A static site generator in 125 lines of Python
The Hugo generated site features can vary with the theme used (I believe there are 200+ options), and the features can get as detailed as a user wants if they just template their own site.

Ox-hugo that the OP mentioned is just an Emacs package that exports Org to Markdown + front-matter (without having to manually specify many of be front matter data in the Org source.. most of it is auto derived.).

kaushalmodi··on Show HN: Makesite – A static site generator in 125 lines of Python
Hey! Ox-hugo dev here. Do you have your site source (Org source) public? I am just collecting Ox-hugo Org source repos, that I plan to publish on the ox-hugo doc site (of source, that won't happen if you don't wish, even if your source is public).

For folks, if interested in seeing an example of the Org source, and ox-hugo + Hugo generated site, here's the source[1] of my blog[2].

More: https://ox-hugo.scripter.co/#demo

[1]: https://gitlab.com/kaushalmodi/kaushalmodi.gitlab.io/raw/mas... [2]: https://scripter.co

kaushalmodi··on Literate Devops with Emacs Org-Mode (2014)
I don't use Mac, so not sure what resolution qualifies as "Retina", but my Dell monitor resolution is 2560 x 1440.
kaushalmodi··on Literate Devops with Emacs Org-Mode (2014)
Tooting my own horn, if you love living in Org mode, and are willing to try out Hugo (https://gohugo.io), I have an Org exporter package ox-hugo that exports to Markdown + required front-matter for Hugo. The package is even more magic if you choose to use a single Org file to export to multiple posts/pages.

Few examples:

1. ox-hugo documentation site from one file[1], source[2]

2. My blog[3]

3. ox-hugo test site (300+ test pages and counting)[4]

[1]: https://ox-hugo.scripter.co/ [2]: https://github.com/kaushalmodi/ox-hugo/raw/master/doc/ox-hug... [3]: https://scripter.co/ [4]: https://ox-hugo.scripter.co/test/

kaushalmodi··on Literate Devops with Emacs Org-Mode (2014)
I am assuming your site remake is still in progress? The fonts on your web site show up in super-huge size at the moment. You can see the font size on other sites like this one for comparison: [1].

[1]: https://i.imgur.com/um3yTdU.png

kaushalmodi··on Literate Devops with Emacs Org-Mode (2014)
You website design is awesome! Do you have the site source public? If allowed, I'd be interested in converting that to a theme for Hugo (https://gohugo.io), and possibly demoing that on how to use that with my package ox-hugo.
kaushalmodi··on Literate Devops with Emacs Org-Mode (2014)
Yes, this came up on /r/emacs recently, see[1] (you can control if you want the HTML preamble and/or postamble).

[1]: https://www.reddit.com/r/emacs/comments/809xwx/how_to_get_pl...

kaushalmodi··on Ask HN: What's a good static site generator to use for a blog in 2018?
> I haven't used Lisp so I'm not sure of how similar they are.

As I said, I can see the syntax to be easy to grasp for anyone knowing any coding language. But Lisp fans would be in for a treat.

In very simple terms, a list function always had the function symbol or identifier as the first element of a list (everything is a list in Lisp), and any number of arguments have to follow after that.

Example of an add function in Lisp:

    (add 1 2)
The same thing in Go templates:

    {{ add 1 2 }}
> Org mode support seems to be interesting. I've always wanted to pick that up as well. Could you share some good resources you might be aware of?

If you use Emacs, the best Org reference is the Org Info manual. Do `C-h i` to open info within Emacs and jump to the Org manual. (You probably aren't using Emacs as you mentioned that you are not familiar with Lisp. So may be this tidbit helps someone else).

If not using Emacs,

- Check out the section on Markup[1] in the official Org manual in HTML. - My blog source in Org[2] - Source of ox-hugo.scripter.co website (100% of the content) from this one Org file [3]

If you don't want to get into too much detail:

    * Heading level 1
    ** Heading level 2, and so on
    *bold* /italics/ _underline_ +strikethrough+
    - list item 1
    - list item 2


    1. ordered list item 1
    2. ordered list item 2
But if you are really getting into Org syntax, here's the mega test file[4] for ox-hugo package that exports to 100's (literally) of Hugo content posts here[5] and gets rendered to HTML by Hugo on https://ox-hugo.scripter.co/test/.

The good news is that you don't have to use Emacs for Org mode, if you plan to use Org mode just like Markdown (and may be a little bit more). If you do use or end up using Emacs, then Org mode is like 1000x Markdown (or may be more :) ).

> Thank you for bringing this up! I appreciate it :)

You are welcome.

Hopefully this response wasn't too much of an information overload.

[1]: https://orgmode.org/manual/Markup.html

[2]: https://gitlab.com/kaushalmodi/kaushalmodi.gitlab.io/raw/mas...

[3]: https://raw.githubusercontent.com/kaushalmodi/ox-hugo/master...

[4]: https://raw.githubusercontent.com/kaushalmodi/ox-hugo/master...

[5]: https://github.com/kaushalmodi/ox-hugo/tree/master/test/site...

kaushalmodi··on Ask HN: What's a good static site generator to use for a blog in 2018?
Like many others said, Hugo (https://gohugo.io) is super-awesome.

- Single static binary for any platform for a static site generator; couldn't get better. - The fastest too! - The Go templating is great! It should be fairly easy to pick up by anyone knowing any programming language. I love it especially because it reminds me of Lisp. Example: {{ or (and $a $b) $c }}. (For the folks that are not a fan of Lisp, you can right the same as {{ and $a $b | or $c }}.)

Hugo has inbuilt support for Org mode. But I use more Org syntax than the inbuilt version can support. So I came up with an Emacs package that's an Org exporter backend that exports to Hugo/Blackfriday Markdown + front-matter -- ox-hugo. Folks appreciative of Emacs Org mode might want to check out the homepage https://ox-hugo.scripter.co/ "dog-fooded" by the package itself :)

kaushalmodi··on Show HN: Eless – A Better less
Yes.

Details:

I have kept the default config close to "emacs -Q" to keep the bash-infused elisp minimal, and because I don't use Vim bindings myself :)

Though, I was sure that that decision wouldn't be the best for everyone. So there's a way to config eless via "~/.emacs.d/elesscfg"[1]. If that file is present, it is loaded after the default config.

So you can add/remove/override any binding, add custom functions and bind those, tweak few faces, or change the theme, anything that elisp allows.. even install packages (Magit comes to mind).

If someone has suggestion for a minimal Vim-equivalent eless config to replace the existing one, please put that in form of an elesscfg file (gist, their repo?), and link that in comments or as an Issue on the eless repo. I'll update the documentation referencing those example configs.

[1]: https://eless.scripter.co/#user-config-override

kaushalmodi··on JIT Compilation for Emacs Lisp
More than the number of lines, it's the number of characters on a single line that causes the slowdown. Thankfully I don't have a real usage scenario where I handle thousand character line files.

I can edit multi-thousand line (5k+) Org documents just fine. So it's probably the major mode or some minor mode(s), or a combination.

kaushalmodi··on GRV – Git Repository Viewer
Magit (Emacs) deserves a mention here: https://magit.vc/. It's the epitome of text based "gui" for any git operation. It's so good that any real Git GUI also doesn't come close.
kaushalmodi··on Why we transitioned from Medium back to our own blog
If you call this tooling, I have developed an Emacs app that allows blogging in native Org mode, leaving out the interpretation of meta-data to happen automatically (the package does the parsing). It's designed to generate Markdown files + front-matter in TOML or YAML for Hugo (https://gohugo.io).

The package is ox-hugo: https://ox-hugo.scripter.co/

In fact, that site is dog-fooding ox-hugo.. I simply commit the Org files, and Org --ox-hugo--> Markdown --hugo--> HTML conversion happens on Netlify, and that site gets updated.

Github repo: https://github.com/kaushalmodi/ox-hugo/

← PreviousPage 4 of 8Next →