DErik's TOC Xprmnts

From RCGRS MRT Wiki
Revision as of 13:37, 20 May 2023 by DErik (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

I have noticed that when I move my cursor over a link to a wiki document, I get a popup window that provides the first few lines from the referenced article. But sometimes, with articles I have created in this wiki, I get a statement that there is an issue with the preview of the article. That disturbed me. So I decided to find out why.

My researches have indicated to me that the problem is with the use of chapter headings and table of contents inclusions.

First off, the wiki processor will include a table of contents automatically if you have at least a specific number of headings. I believe that number is 4. I read that somewhere, but have lost the help page that told me that. (Those help pages are so obscure, hidden, and not organized to my liking at all.) And they can be at any level (2 through 5 are provided in the editor's tool bar; but heading level 1 does exist as well, sort of as a substitute for a page title, though). The default TOC appears to always be placed to the left of your text, at the top of the page.

Alternatively, you can force a TOC to be placed some else in the page. To do that you use the magic word __TOC__. But this places it to the left

of whatever line or paragraph it is placed in. Eric Timberlake has created a "template" called "rtoc" (full name is Template:rtoc) which you can include in your article at any point just like the __TOC__ magic word. In fact, what he has done is to simply wrap that magic word in some HTML that puts the TOC to the right of whatever line or paragraph you place it in.

You can include that template using the following text

{{rtoc}}

on a line by itself, left justified. (I'd show you, but you can only have one TOC in the article, and I've already got it above. See some of the othr articles.) This syntax is called "transclusion" and is used for other things as well. But that discussion is for some other place and time.

Now, the problem is that if you include the TOC, or a header at any level, before any text, then the preview popup bubble just displays that nasty message saying there is an issue. Incidentally, this includes putting a header, whether in HTML or in Wiki markup, before any text.

And it applies to links as well, at least to images. But putting an image reference immediately after a TOC inclusion will display the image as part of the preview. That could be a very good thing. For example, place your cursor over the following reference: 29 Apr, 2023 Minutes

So - bottom line - (or top line?) - put some plain text in the top of your article. This is one reason to include a synopsis of your article as the first part of it. It allows that preview popup bubble to display something about the article before the viewer actually clicks on it to see the whole article.




Here's my latest test case. And the results of testing in a table.

Popup bubble preview testing
All headers are followed by text
Order Headings? Auto TOC? Result
text only none no OK, stops at table
text, header 1 no OK, stops at header
text, header 4 yes OK, stops at header
header 1 no issue
header 4 yes issue
TOC, text only none NA OK, stops at table
TOC, text, header 1 NA issue
TOC, text, header 4 NA issue
TOC, header none NA OK, stops at table
TOC, header 1 NA issue
TOC, header 4 NA issue
Text, TOC none NA OK, stops at table
Text, TOC, header 1 NA OK, stops at header
Space, TOC, header 1 NA issue
Line with space, TOC, header 1 NA issue

Always put some text (synopsis) before a TOC and before the first header (regardless of the heading level).
A TOC can follow the initial text, and before or after the header, or actually anywhere in the article.

First Level 1 Heading

No auto TOC yet TOC after first header
A second TOC request is ignored.

= Second L1 Heading =
No auto TOC yet
= Third L1 Heading =
No auto TOC yet
= Fourth L1 Heading =
Caused automatic TOC to display