Cannot fix Wiki article TOC RRS feed

  • Question

  • First, thank you Peter Geelen (MSFT) for spotting my comment (yesterday) in this Wiki article:


    where I complained that I could not fix the toc (Table of Contents) in this article:


    The first Wiki above suggested that I leave a comment if I was having problems, but I think it is better to use this forum to discuss issues like this. Based on my comment, Peter has revised the second Wiki I linked above, plus added this new Wiki with great advice:


    I appreciate this effort. However, the toc in the ADFS Wiki, while improved, is still broken. The article isn't mine, I'm just trying to get the author's intent reflected in the toc. Also, I do all of my work in the HTML editor, except entering text. I don't trust the Wiki editor except for word wrapping text. The version I started with yesterday had unbalanced tags, resulting in a paragraph being interpreted as a header and showing up in the toc, but that was easily fixed.

    Orginally, the three header lines "What is AD FS 2.0?", "Install AD FS 2.0", and "Manage AD FS 2.0" did not show up in the toc. I tried lots of things, including removing the header lines and re-entering, but nothing worked. One of Peter's edits made "What is AD FS 2.0?" show in the toc (I cannot tell what he did), but one of the last edits somehow made it drop out again. As of now, the header lines "Install AD FS 2.0" and "Manage AD FS 2.0" both show up in the toc, which is great, but they technically don't work. In the HTML editor I see that the anchor tag names for both are duplicates of the names for "Install AD FS 1.x" and "Manage AD FS 1.x". When I tested, I found that when you click "Install AD FS 1.x" in the toc, you go to "Install AD FS 2.0". I just tried fixing the anchor tag names in the HTML editor, but when I clicked "Save", the anchor tag names I used were changed and neither header appeared in the toc, so I reverted this edit. The article is back to a state where 2 of the 3 problem headers are in the toc, but the 2 new entries link to the wrong location.

    The advice given in the new Wiki article to fix toc's is good, but I fear there is a bug in the Wiki editor. Some code must run when you click "Save" that "fixes" the HTML. In particular, header anchor tag names are added or modified. I have no idea how the toc code works. I've stared at the HTML for this article for some time and cannot find the problems. I suspect that somebody familiar with the code that runs when you click "Save" must look at this. Whatever the problem is might account for the comment I saw that about 5% of the time the toc cannot be fixed, in this article:


    Richard Mueller - MVP Directory Services

    Monday, July 30, 2012 3:15 PM


All replies

  • I see I spoke too soon. Peter is still working on the problem Wiki article. He seems to have fixed two of the headers by manually changing the anchor tag names so they don't include any underscores. He is also experiencing the same problem I did where the Save code tends to duplicate an anchor tag if you are not careful. If he fixes the last tag, I hope he sees this thread and explains how he fixed the toc in the problem article.

    Richard Mueller - MVP Directory Services

    Monday, July 30, 2012 3:44 PM
  • Peter Geelen has found the cause of my problem, as explained in this new Wiki article:


    All three of the problem header lines in the Wiki article I complained about had anchor tags that ended with a "0" character (other than characters that are ignored, like "?"). Peter's solution was to edit the anchor tag so the name does not end with "0". The article now has a fully functional toc. The three problem header lines in the article are now as follows (in the HTML editor):

    <h1><a name="What_is_ADFS_2"></a>What is ADFS 2.0?</h1>

    <h2><a name="InstallADFS1"></a>Install AD FS 1.x</h2>

    <h2><a name="ManageADFS2"></a>Manage AD FS 2.0</h2>

    Notice how the anchor tag names have been modified so the last character is not a "0".

    If anyone else has had problems with the toc, please check the Wiki article I linked, and check in the HTML editor for header anchor tag names ending with "0".

    Richard Mueller - MVP Directory Services

    Tuesday, July 31, 2012 12:21 AM
  • I've done a lot more experimentation with toc's (Table of Contents) in TechNet Wiki articles. In all cases (I have seen) where a header is not included in the toc:

    • The header has digits
    • After you save, the anchor tag is duplicated (if there was one before you saved)

    For example, I had trouble with the following header in an article (in HTML view):

    <h2><a name="Install ADFS on Windows Server 2008R2"></a>Install ADFS on Windows Server 2008R2</h2>

    After I saved, the header did not appear in the toc, and when I clicked to edit and checked the HTML the line was changed to this:

    <h2><a name="Install ADFS on Windows Server 2008R2"></a><a name="Install ADFS on Windows Server 2008R2"></a>Install ADFS on Windows Server 2008R2</h2>

    Somehow, the code to create the toc saw something wrong with this header, duplicated the anchor tag, then did not include this header in the toc. The fix (for me) was to eliminate all digits and other characters in the anchor tag name, as follows:

    <h2><a name="InstallADFSonWindowsServer"></a>Install ADFS on Windows Server 2008R2</h2>

    When I saved this version, the header appeared in the toc (and the toc worked). The anchor, between the <a> and </a> tags, is not seen in the article. This is just a label for the toc, telling the code where to jump to when you click on "Install ADFS on Windows Server 2008R2" in the toc. The only condition is that the anchor tag name must be unique in the Wiki article. The string in the header, between the <h2> and </h2> tags (not counting the anchor tag), is seen by people reading the article, both in the article and in the toc. That string can be anything.

    So far I have fixed 4 header lines that failed to show up in the toc. All had digits, and my fix was as above, removing all digits and underscores in the anchor tag name (and also removing the duplicate anchors). All of this was done in the HTML editor.

    Richard Mueller - MVP Directory Services

    Tuesday, July 31, 2012 4:31 PM
  • In the last few days I've fixed the toc (table of contents) in many Wiki articles. In all cases, the problem header lines (with <h> tags in the HTML) had digits in the anchor tag (within <a> tags inside the <h> tags). The digits can be anywhere in the anchor name. The most common digit is "0", but there is evidence that "5", "6", "7", and "9" can also cause this problem.

    When the problem shows up, it seems that every time the article is saved, a new duplicate anchor tag is saved. I've seen problem header lines with ten or more duplicate anchor tags.

    The fix (for me) is to use the HTML editor and seach for all instances of "<h". Ignore instances of "</hr>" and "<html>", but look for all "<h>" tags (like "<h1>", "<h2>", "<h3>", etc.) and see if the "<a name" tag has digits. These names (in quotes) need to be unique in the article, but my fix is replace all digits with something else, usually the digit spelled out. For example, I replaced the following HTML line:

    <h1><a name="BizTalk_Server_Adapter_Pack_2010"></a><a name="BizTalk_Server_Adapter_Pack_2010"></a><a name="BizTalk_Server_Adapter_Pack_2010"></a><a name="BizTalk_Server_Adapter_Pack_2010"></a><a name="BizTalk_Server_Adapter_Pack_2010"></a><a name="BizTalk_Server_Adapter_Pack_2010"></a><a name="BizTalk_Server_Adapter_Pack_2010"></a>BizTalk Server Adapter Pack 2010</h1>

    with the following:

    <h1><a name="BizTalkServerAdapterPackTwentyTen"></a>BizTalk Server Adapter Pack 2010</h1>

    I'm surprised by how many articles exhibit this problem. I guess any article with a [toc] and "2007" or "2010" or any Version number in any header can have the problem. Maybe the best solution is to fix the code the implements [toc]. It takes some bravery (and time) to fix the HTML.

    Richard Mueller - MVP Directory Services

    Thursday, August 2, 2012 5:19 PM
  • Richard,

    I experienced the both issues too, but I initialiy linked the issue to IE10, but further testing on IE8 (XP) did show the same behavior. So I reported both problems to the Wiki platform owners a:

    - headers with 0 do not show up in the TOC
    - headers with 0 duplicate their <a name> HTLM tags.

    The '0' header issue with the TOC is confirmed as a bug in the platform, and no immediate fix available (until further notice).
    I initially discovered that the issue appeared with trailing "0" character.
    But the developers found that the issue pops up with headers containing "0".

    So, I've added the issue with explanation to the Wiki: Known Issues (en-US) page.


    So, in summary: please find all information on the TOC/headers/bug:

    Peter Geelen (Microsoft Belgium) - Premier Field Engineer Security & Identity

    [If a post helps to resolve your issue, please click the "Mark as Answer" of that post or "Helpful" button of that post.
    By marking a post as Answered or Helpful, you help others find the answer faster.

    Sunday, August 5, 2012 9:35 PM
  • Thank you very much. I thought for awhile that other digits caused problems, but I've decided it is only zero's. Every header with a "0" anywhere seems to cause this. Thanks again.

    Oh, and I also experienced problems if the <a name> is not unique. The headers show up in the toc, but both entries in the toc link to the first header with the name. This happens if someone copies the header, but only modifies the header itself and leaves the <a name> alone, so it's a duplicate.

    Richard Mueller - MVP Directory Services

    Monday, August 6, 2012 12:49 AM