Obsidian-Code-Styler icon indicating copy to clipboard operation
Obsidian-Code-Styler copied to clipboard

Feature Request: Codeblock Tabs

Open mayurankv opened this issue 1 year ago • 4 comments

Summary

Add codeblock tabs above the header optionally.

Basic example

Self explanatory

Motivation

Allow for more concise displaying of code

Existing Requests?

No

mayurankv avatar Feb 01 '25 14:02 mayurankv

How to write syntax for this?

  1. Should it be consecutive codeblocks are pulled into a single codeblock if they have the tab argument?
  2. This would be hard to do in live preview mode and near on impossible in reading mode? How would I do this?
  3. Add internal syntax for separating existing codeblocks into tabs?
  4. This would play funny with syntax highlighting
  5. Add specific codeblock processor for tabbed codeblocks?
  6. This would play funny with syntax highlighting

Would welcome any input on this topic!

mayurankv avatar Feb 01 '25 15:02 mayurankv

See this unmaintained plugin: https://github.com/JeminMau/Obsidian-CodeBlock-Tabs

mayurankv avatar Feb 06 '25 11:02 mayurankv

@mayurankv I have some thoughts on how this would work but I'm no RUST or web dev so it might be impossible or too difficult to do.

  1. I think the tab argument added to the codeblock could work well. Maybe something like tab:# to designate how many of the next codeblocks should be included in the tabbed codeblock. So tab:3 would take the next 3 codeblocks and add them as tabs to a singular codeblock.
  2. Again, not a program or web dev, but could an accordion style JavaScript be used in a similar manner? Does JavaScript code exist to make tabs from navigation menus?
  3. Maybe a codeblock ID could be required for each codeblock and then combine each individual with the same ID into the same tabbed-codeblock. Could be as simple as id:strings, etc. All codeblocks with id:strings would be included in a tabbed-codeblock.
  4. I'm not 100% sure I follow what syntax highlighting formatting issues you might expect. Again, not a dev so I don't know the code for Obsidian or your plugin (but I love the plugin, thank you)!
  5. Would that be necessary or would the JavaScript handle such a thing?

Edit: Also, step 4 and 6 are the same!

ITMighty avatar May 06 '25 17:05 ITMighty

This issue is stale because it has been open 60 days with no activity.

github-actions[bot] avatar Mar 03 '26 03:03 github-actions[bot]