docuapi icon indicating copy to clipboard operation
docuapi copied to clipboard

Multiple languages by tab?

Open maelle opened this issue 5 years ago • 2 comments

Thanks for creating this useful theme!

I have a question that might be a limitation of Slatedocs itself.

I'd like to be able to define tabs that show several languages.

For instance, for documenting a web API that has an R client providing parsed output

  • A tab with R code and R output
  • A tab with shell commands and JSON/XML output.

My workaround is to define the second tab for "JavaScript" because highlighting shell/JSON/XML as if it were JavaScript does not look too horrible.

Any insight on how to tweak this theme to be able to use something like

[[params.language_tabs]]
  key = "r"
  name = "R" 
[[params.language_tabs]]
  key = "shell"
  name = "Shell"
  otherlangs = ["json", "xml"] 

is welcome. 🙂 I guess I'd need to tinker with https://github.com/bep/docuapi/blob/master/assets/js/slate/app/_lang.js and https://github.com/bep/docuapi/blob/fc2d3f5524f167dd5fcc9ce3d4a9eef4f79f371f/layouts/_default/baseof.html#L25 (where there could be, say, data-language-name and data-languages-name, one for the URL stuff -- key, one for the hiding/showing -- key+otherlangs 🤔) and https://github.com/bep/docuapi/blob/fc2d3f5524f167dd5fcc9ce3d4a9eef4f79f371f/layouts/_default/baseof.html#L12 (that'd use key and otherlangs in my "proposal").

maelle avatar May 09 '20 17:05 maelle

I'm not sure how generally usefull such a feature would be (I understand that you need it), but it should be possible to do the mods in this theme. Your thoughts above looks sensible.

bep avatar May 09 '20 19:05 bep

Cool, I'll experiment in a fork next week. In the "worst case", I'll keep my edits as custom layouts.

maelle avatar May 10 '20 05:05 maelle