[v2] Alternative way for handling code tabs or add docs preprocessing hook
See original GitHub issue💥 Proposal
It would be nice to have an alternative way of defining code-tabs that doesn’t rely on MDX Tabs/TabItem. This is specially interesting for teams that don’t have MDX knowledge or that don’t want to use it (for portability, readability…).
E.g. if one or more code blocks are next to each other convert them into code-tabs:
```kotlin
// Some code
```
```typescript
// Some code
```
👆 In this case there should be a way also to map code-block language hint to tab name. e.g. typescript => TypeScript.
Alternatively, there could be a way to hook to the markdown loading step so that the developers could modify the markdown content programatically. e.g. search via regex and add the required Tabs/Tabitem code.
[load markdown] => [hook modifies markdown content] => [render]
Have you read the Contributing Guidelines on issues?
Yes.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
badeball/cypress-cucumber-preprocessor - GitHub
The preprocessor (with its dependencies) parses Gherkin documents and allows you to write tests as shown below. # cypress/e2e/duckduckgo.feature Feature: ...
Read more >Preprocessing and Postprocessing - Amazon SageMaker
Extend the code with the preprocessing and postprocessing scripts.
Read more >gform_field_settings_tab_content
The gform_field_settings_tab_content action hook is used to echo the content for a custom field settings tab in the form editor.
Read more >React Hooks example #1 counter - CodePen
... use a URL Extension of the type of code you want to link to. Either .css , .js , or the extension...
Read more >Hooks | core.api.php | Drupal 9.0.x
Name Location Descr...
hook_aggregator_fetcher_info_alter core/modules/aggregator/aggregator.api.php Perfo...
hook_aggregator_parser_info_alter core/modules/aggregator/aggregator.api.php Perfo...
hook_aggregator_processor_info_alter core/modules/aggregator/aggregator.api.php Perfo...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Agree with @yangshun that it can be difficult to tell if code blocks should be grouped or tabbed. Someone else might want them as individual code blocks without tabs.
This feels like getting into the territory of markdown parser and that’s not what Docusaurus is for/does.
Hard to tell if code blocks should be grouped together. One possible way is to add in metadata into the first line to define the group.
But overall I’m not very keen on adding more syntax if MDX can do the job. If you’re going to have a new syntax, MDX can be that syntax. MDX is easy to use and is very expressive.