No headers in sidebar

I have a strange problem happening in all sidebar tiddlers, namely, it won’t display headers. So !!Header one, instead of showing Header one as a second level header ,just displays !!Header one (not wikified). I can use other formatting options though, bold, italic, links, etc, just not the header.

Has anyone else encountered a problem like this?

I just tested and seeing this as well.

In a tiddler displayed in the river, you get this:

<div class="tc-tiddler-body tc-clearfix tc-reveal">
<h2 class="">Header one</h2>
</div>

and in the sidebar you get:

<div class="content">
"!!Header one"
</div>

It is in quotes, so displaying it as literal text instead of converting it to an h2 tag.

I assume it is a matter of different css and scripting being applied when in the sidebar. I would suggest using physical HTML header instead of relying on the conversion when using it in the sidebar.

<h2>Header one</h2>

At least until they can figure out why the wikification is not working for headers

Wikitext headers work in the sidebar.

  • If the header is in the first line of the tiddler, no space is needed above the header.
  • If the header follows other text, there needs to be a blank line between the other text and the header.

headers-test

Any block-level (entire paragraph) formatting needs a blank line between it and any preceding text.

<div class="content">

!!Header one
</div>

Yes, normally this is what happens, that is why it is stumping me right now. I must have changed something in the latest revision of my wiki.

I have this in the tiddler (for example)

!!Heading 

* Item 1
* [[Item 2|28th January 2025]]

''More text''

!!Heading

//More text//

It looks fine in the tiddler, but in the sidebar it looks like this

sidebar

What else affects what is in the sidebar? I have a stripped down version of my wiki from a few weeks ago and that seems to work. Doesn’t the sidebar just display the tiddler, it’s not affected by any macros or anything in the rest of the wiki, right?

Well, it certainly is affected by whatever CSS you have on the page. My suspicion is that you have CSS targeted somewhere else that also captures this usage. Is your wiki online somewhere we could look at?

Unlike inline styling like bold or italics, wikitext headings and lists are only parsed correctly in block mode; typically, this means including a blank line above each section. Since you’re using a non-standard sidebar, I suspect that your tiddler is being transcluded in inline mode rather than block, so only inline wikitext is correctly displayed. You’ll see a similar effect in the Test Sidebar tiddler itself if you remove the line before the second !!Heading.

Could you show us the content of the tiddler that’s generating your sidebar? It’s possible that the solution is as simple as changing <$transclude/> to <$transclude mode=block/>, or adding a blank line above the !!text transclusion.

I know this is impossible to diagnose without something to look at so I created two public wikis, one that is working, one that isn’t. They are both the same (mostly) so I don’t know what is causing the one to not work.

Working version: https://pointed-bowing-61.tiddlyhost.com/
Broken version: https://tardy-falloff-43.tiddlyhost.com/

Sorry if it’s a bit messy, it was never meant for public consumption. :slight_smile:

Thanks, that helped me find the issue! In $:/themes/nico/notebook/ui/Sidebar/SectionTemplate, change the line

      <$transclude $tiddler=<<currentTiddler>> mode="block"/>

to either (legacy syntax)

      <$transclude tiddler=<<currentTiddler>> mode="block"/>

or (modern syntax)

      <$transclude $tiddler=<<currentTiddler>> $mode="block"/>

and that should solve your problem.

To understand what went wrong here and why this fixes it, we need to look at the transclude widget. You’ll see that the Attributes table includes two columns, one for modern and one for legacy attributes. $tiddler belongs to the modern category, and using it (or any attribute prefixed with $) automatically moves you into modern mode, where any attribute that doesn’t start with $ will be treated as an additional parameter to the transclusion — analagous to defining a variable. So the mode in your code was treated as a nonexistent parameter, and didn’t actually force the parser into block mode.

You can use either legacy or modern mode without issue, but you do need to be consistent to avoid this sort of problem.

2 Likes

That does work, thank you!

Do you know why the working version works then? The code is exactly the same. Technically it shouldn’t work because it has a mix of old/new as well but it does for some reason.

1 Like

I’m actually not sure the “working version” does work; when I imported your “Sidebar Test” tiddler into the “working” wiki, I get the same inline parsing results The other sidebar items (which do work correctly) seem to use HTML tags rather than wikitext, so the parsing mode doesn’t become an issue. But if you’re seeing something I’m not, could you give me a screenshot and/or a specific tiddler to look at?

The one I actually use works now and that is all that’s important. Thank you for your help. I never would have found that.

1 Like

I will just add, when you use a tag to place an element in tiddlywiki you can use the list-before or list-after field with an empty value to place it at the top or bottom of the current tiddlers so tagged such as here with $:/tags/SideBar