obsidian-html-tabs icon indicating copy to clipboard operation
obsidian-html-tabs copied to clipboard

Tabs (indents) not rendering on tabs

Open MyNameIsntFred opened this issue 2 years ago • 1 comments

Hi @ptournet, thanks for an awesome plugin.

I have noticed that tabs (indents) don't render properly for me. Obsidian version: 1.5.3 OS: Linux Plugin version: 1.1.0 Theme: ITS Theme (Nord+Minimalist) Problem: Tabs (indent) not rendering

I'm not sure if the theme is the issue but I've noticed it across many projects so I don't believe it is.

image

This small change to your code seems to fix it though. Function parseTabs

    } else if (newTab) {
      if (newTab.content === "") {
        newTab.content += line.text;
      } else {
        strLine = line.text.replace(/\t/g, "  ")
        newTab.content += "\n" + strLine;
//          newTab.content += "\n" + line.text;

      }

image

I'm not sure if this is the correct way to fix this issue though.

Code to generate tabs

```tabs
---tab tab1
Point 1
	a
	b
	c
Point 2
	a
	b
	c


---tab tab2
---tab tab3

MyNameIsntFred avatar Feb 16 '24 01:02 MyNameIsntFred

Most code blocks treat their contents as "pre-formatted" and will, therefore, maintain whitespace. However, this plugin simply uses the code block as a container for other Markdown content. Markdown ignores whitespace, including tabs, so it's working as intended.

If you want content to be indented, you could make it a bulleted list or use a traditional code block.

breakid avatar Jun 15 '25 06:06 breakid