Is there a way to create tabbed code blocks like the following in Mkdocs or Sphinx?
There is sphinxcontrib-osexample, which tries to implement such a feature, but it's very rudimentary!
Example from their documentation:
There is the markdown-fenced-code-tabs extension. I use it with MkDocs
.
## Tabs
```curl
$ curl -O wget http://example.com/pk.zip
```
```wget
$ wget http://example.com/pk.zip
```
## Single block
```
$ ls -lisa
```
Becomes
And also https://github.com/mikecules/MarkdownBSCodeTabs for mkdocs that does the same as markdown-fenced-code-tabs
There is an issue with both of them, if you include multiples code block with the same language, they all will be displayed with the same name, but you wont be able to switch between them.
Furthermore the spark documentation (written in Jekyll) has nice code tabs.
See https://github.com/apache/spark/blob/master/docs/quick-start.md for example.
There is an mkdocs extension -CodeHilite- which leverages another extension -SuperFences- which works wonders for code examples in different languages / situations. This is part of the PyMdown collection of extensions.
In addition, CodeHilite provides:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With