monome / docs

monome.org/docs
https://monome.org/docs
Creative Commons Attribution 4.0 International
127 stars 85 forks source link

Code isn't syntax highlighted - thoughts on embedded Github gists? #255

Closed mwilliams closed 4 years ago

mwilliams commented 4 years ago

Just got my DIY Norns (assembled quickly and works flawlessly by the way, fantastic kit!) as I started going through the studies. I noticed a missing space on line 16 of the many tomorrow code sample from https://monome.org/docs/norns/study-1/:

octave =1

Wanted to fix it quickly but requiring a pull request approval etc etc and presumably a re-deployment of the website for a 1 space fix is a lot of work (and it's just aesthetics, the code is still functional). Would Monome be up for using embedded Github gists (<script src="https://gist.github.com/mwilliams/79fa4fe7835755d291c739582fc15ca8.js"></script> for example which would render out on the Studies page a very nice code sample) for all the code samples? People could fork them if they wanted (the more complex ones), you get syntax color highlighting for free, along with line numbers etc etc. Seems like there's a lot of upside. And if you need to fix any code examples, you just need to update the Gist and not the entire website.

I'd be up for potentially porting over all of the Norns code samples as I go through its Studies, is this an effort that's worthwhile and would be welcomed?

tehn commented 4 years ago

hi matt! glad the kit worked so easily.

we have the repo set up so it auto-redeploys with each new merge--- since the docs are hosted on github pages. i know it's a hassle to PR each little fix.

better syntax highlighting would be great--- any ideas how we might get that within the pages framework?

i'd be up for using gists for the big code blocks--- it has the added bonus of being easily downloadable. but i think it'd be pertinent to centralize them to the community repo for group edit-ability--- on quick glance are gists just for personal accounts?

mwilliams commented 4 years ago

Ah, I definitely over complicated things and the structure of the way things are deployed is great!

With markdown you can simply add the language name after the triple ticks and get instant highlighting.

Example:

-- many tomorrows
-- norns study 1

engine.name = "TestSine"

function init()
  print("the end and the beginning they are the same.")
end

Perhaps as I go through the Norns studies, I’ll update all the Lua code blocks and get PRs up as I move along. As long as the change is welcome, I’ll issue PRs as I go along!

mwilliams commented 4 years ago

(And hello from the Hudson Valley! Definitely not the most active Norns user here!)

tehn commented 4 years ago

i'm wondering if our jekyll theme properly supports syntax highlighting. the studies predate the move to gh-pages--- previously we hosted our own server. i'll do a quick test.


indeed we need to have a upstate gathering someday. bunch of us are nearby!

tehn commented 4 years ago

sadly something is either up with the jekyll plugin or stylesheet

https://github.com/monome/docs/commit/7f678a9afc8f57a0c05de3eb5d33c66145195a1b

i don't have bandwidth for this immediately, hopefully someone can jump in

mwilliams commented 4 years ago

Sounds great, and I’ll take a peek as well and see if I can figure anything out.

That would require pulling myself away from Norns itself!

On Mon, Jun 15, 2020 at 8:13 PM brian crabtree notifications@github.com wrote:

sadly something is either up with the jekyll plugin or stylesheet

7f678a9 https://github.com/monome/docs/commit/7f678a9afc8f57a0c05de3eb5d33c66145195a1b

i don't have bandwidth for this immediately, hopefully someone can jump in

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/monome/docs/issues/255#issuecomment-644455359, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAAEDKR3UGCFYXRARDLWNTRW22LLANCNFSM4N6T62ZA .

csboling commented 4 years ago

Not sure if something changed with the gh-pages options but this does appear to be working now for the code blocks that have the lua tag, which is a fair number of them. Most of the rest are in https://github.com/monome/docs/pull/260.

image