Skip to content

Comments

Populate table of contents using section text instead of ID#235

Open
cosmicmarley17 wants to merge 2 commits intohugolabe:masterfrom
cosmicmarley17:cosmicmarley17/232-main-page-toc
Open

Populate table of contents using section text instead of ID#235
cosmicmarley17 wants to merge 2 commits intohugolabe:masterfrom
cosmicmarley17:cosmicmarley17/232-main-page-toc

Conversation

@cosmicmarley17
Copy link

Hi, this is a small change to address #232:

Use the section text ("line") values to populate the table of contents, rather than their IDs.

The section text may include style tags (e.g. <i> ... </i>), so markup formatting is enabled with the use-markup property. It's actually parsing it as Pango, but most of the basic HTML style tags are included in Pango.

Populate the table of contents with the text of the section elements
rather than their IDs.

This corrects the error on the Wikipedia main page
(https://en.wikipedia.org/wiki/Main_Page) where the anchor IDs do not
represent the expected section names. (Issue hugolabe#232)
Since the TOC is populated with the section line instead of its ID,
formatting tags like `<i> ... </i>` are displayed. But if markup is
enabled in the GtkLabel, then the formatting tags are applied.

This also preserves meaning from italicized words in the section names.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant