3 ms·
I wrote a <100 lines of python that takes a nested set of markdown files and outputs a mirror structure rendered as HTML (any file starting with a _ is skipped
by noir_lord 6y ago
I wrote a <100 lines of python that takes a nested set of markdown files and outputs a mirror structure rendered as HTML (any file starting with a _ is skipped for works in progress), threw tufte.css on top of it and I have a page that loads in 9ms over wifi and renders so close to instant it's not worth measure.
Has syntax highlighting as well, beyond that I wrote it myself because it let me do exactly what I wanted the way I wanted.
Code is here if it's any use to you https://kopy.io/ibFMc https://kopy.io/ibFMc
It supports Jinja templates and you can put meta data in the header so you can choose what template you want, override the title etc.
If you don't override the title 10-tricks-to-foo becomes "10 tricks to foo" automatically
I've used that script to write technical documentation as well, I just swapped out the template and everything else stayed the same, in terms of time to value reward it's up there for the most useful code I've written in a long time.
- AndrewStephens 6y agoAre you me? That is almost exactly what I did, even including the part about tufte.css and syntax highlighting. I ended up exporting all of my old blog posts from WordPress. Rebuilding the entire site (~370 pages) takes about 4 seconds. The biggest problem I found was that I had to modify tufte.css to make it work well on mobile. Care to post your site? Mine, if you are curious: https://sheep.horse/ https://sheep.horse/
- noir_lord 6y agoGreat minds, my site is on my real name and I'd rather not connect my user name with my handle so publicly, it's got nowhere near the amount of content yours has though. In my case there is a certain irony in writing it in Python the lazy way since I'm a full stack dev who writes typescript, js and PHP for work. Never trust a builder with a finished house I guess applies, I didn't want anything I'd have to maintain.
- yobananaboy 6y agoI really like the margin notes layout of your site! Might have to steal that. edit: oh wait that's what the Tufte css is! What tweaks did you end up making?
- AndrewStephens 6y agoIt might have changed recently, but tufte.css used to behave badly in portrait (say on a mobile phone, or just with a narrow browser window.) Part of the problem is just the design works a lot better in landscape. It took me a lot of fiddling before I managed to find an acceptable compromise. If I was going to start again I might consider implementing the margin notes differently. They interact oddly with each other and image captions.
- bradley_taunt 6y agoNot to be annoying and plug my own projects, but I've tweaked Tufte CSS to work within a jekyll theme: https://et-jekyll.netlify.app/ https://et-jekyll.netlify.app/
- gen220 6y agoOut of curiosity, did you consider using pandoc? https://pandoc.org/MANUAL.html https://pandoc.org/MANUAL.html For context/the uninitiaatd, I think of pandoc as the "postgres" of markdown-to-<blessed_format>: you can build your own text-format-converter, but oftentimes you can get 90% of the way there with pandoc, and fill in the rest with custom filters and elbow grease. To whet your appetite, I have a personal site that checks your boxes, where the build script is basically one long invocation of pandoc and xargs. In my experience and that of others', building on top of pandoc can get you to quite satisfying places and workflows (e.g. https://www.gwern.net/About https://www.gwern.net/About). (Also, fwiw, we use it at my place of work for writing versioned technical documentation, as well.) Keep on plain-texting! :)
- noir_lord 6y agoI've used it in the past but I reach for Python most of the time.