Wiki - Table of Content

Wiki - Table of Content

by Ulrich Kerzel -
Number of replies: 5

Dear all,


we're using Moodle 2.8.3 for our internal training and I'e added a site-wide wiki to the main menu for general FAQs, etc


However, the ToC doesn't really seem to work.

Sections with heading (large) are listed as 

1.1.1

1.1.2

etc

some headings are bigger than others and some headings don't appear at all.


Is there a way to fix this or switch the ToC off completely in the meantime?


Many thanks for your help in advance


All the best

Ulrich

Average of ratings: -
In reply to Ulrich Kerzel

Re: Wiki - Table of Content

by David Dunn -

Check what type of wiki format you are using: html, creole or nwiki.

I've only used the first format to date. There the ToC is automatically generated when headings 1, 2 and 3 (H1, H2, H3) are used in the wiki.

Check the html of the wiki page to see if the headings are being used correctly and consistently to display what the student wants.

Average of ratings: Useful (1)
In reply to David Dunn

Re: Wiki - Table of Content

by Ulrich Kerzel -

Hi David,


many thanks for your reply.


I've tried with all wiki settings (HTML, creole, nwiki) - same effect. I've now set it back to HTML but the issue remains.


I mainly use "Heading (large)" with a few "Heading (medium)" here and there and would have expected to see

1.

2.

3.

but I get 

1.1.1

1.1.2

etc

Looking at the HTML I get something like the following:

<h3>How to change your time-zone</h3><p>By default the Moodle server runs in the timezone "Europe/Berlin".</p><p>Your default time-zone settings when you log in follow the server's defaults, you can override this by</p><p></p><ol><li>Go to "My Profile Settings"</li><li>Go to "Edit Profile"</li><li>Change Timezone to e.g. "Europe/London"</li></ol><h3>How to import the 

This would indeed explain the issue - It's using <h3> in the HTML but the "large" and "medium" in the visual editor and when displaying the wiki (the size of the headings look alright when looking at it. 

Could this be an issue that the mapping from "Heading (large)" is done to <h3> instead of <h1>?

If I change the HTML manually it seems to work


All the best

Ulrich



In reply to Ulrich Kerzel

Re: Wiki - Table of Content

by David Thomas -

I, too, am having the same problem.  When users select Heading Large, Heading Medium or Heading small from the editor,  it saves as H3, H4 and H5.  Going into the HTML one can change it manually back to the desired headings, but it is very frustrating for students who don't feel confident editing the HTML.   There must be some code rewriting the headings or those settings for Large, medium and small are in a CSS somewhere set to H3, H4, and H5.


Here is sample HTML generated from using the Heading Large, Heading Medium and Heading small:


<h3>Mammals</h3><p>There are many types of mammals.</p><h4>Mammals that eat us</h4><h5>Lions</h5><p>Lions are a type of cat.&nbsp;</p><h5>Tigers</h5><p>Tigers are a type of cat.</p><h5>Bears</h5><p>Bears are a type of bear.</p><h4>Mammals that we eat</h4><h5>Cows</h5><p>Cows are made of meat.</p><h5>Pigs</h5><p>Bacon comes from pigs.</p><p><br></p>

In reply to Ulrich Kerzel

Re: Wiki - Table of Content

by Les Bell -

I just struck the same problem. Here's what I found:

If you use the Atto HTML editor, its "(large)", "(medium)" and "(small)" headings translate to <h3>, <h4> and <h5> respectively. However, the Table of Contents generation expects the heading levels to be <h1>, <h2> and <h3>. Manually editing the HTML and correcting the heading levels gives correct ToC generation.

The TinyMCE editor doesn't have this problem - its heading levels map to the correct HTML.

However, if you're using the "Clean" theme, you'll now find that the wiki name at the top of the page is now formatted as <h2> and the page title is <h3>. But inside the page, your section headings will now be a much larger <h1>.

I'm guessing there are two ways to fix the problem, and both involve a lot more digging into the guts of either the theme CSS or the wiki PHP code:

1) Edit the CSS so that the wiki title (which is in a <div role="main">) and the page title (which is an <h3> with a unique ID, e.g. <h3 id="yui_3_17_2_2_1439114035470_605">) are given a larger or more distinct font and the top-level heading in the page (e.g. <h1 id="yui_3_17_2_2_1439114035470_620"><a name="toc-1"></a>Top Level Section <a href="edit.php?pageid=24&amp;section=Identity+Management+Principles" class="wiki_edit_section">[edit]</a></h1>) is a smaller font.

2) Change the wiki code so that it processes <h3> - <h5> as levels 1 - 3.

It might be interesting - I don't have time tonight - to edit the HTML directly so that the top-level heading is <h3 id="xxx"><a name="toc-1"></a>Top Level Section . . . </h3>. I wonder if that would parse as a level 1 heading while remaining an <h3> in terms of format?

--- Les

Average of ratings: Useful (1)
In reply to Les Bell

Re: Wiki - Table of Content

by Les Bell -

A brief follow-up: Bruno Manzoni's patch at https://moodle.org/mod/forum/discuss.php?d=270112 provides an adequate fix, as long as you're working with the Atto editor. This works for me, because I've already got a Style Guide that uses H1 and H2 for blocks in a course page, and H3 - H5 in articles and wiki pages - which map to "Heading (Large)" down to "Heading (small)" in Atto. I just have to remember to reapply the patch after every upgrade. . .

Average of ratings: Useful (1)