Skip to content

Conversation

@0xMax42
Copy link

@0xMax42 0xMax42 commented Dec 3, 2023

See also #17

Overview

This Pull Request introduces an featureto the text extraction process used in generating the Table of Contents (TOC) for PicoCMS. Specifically, it adds the capability to exclude certain HTML tags (e.g., <sup>) from the text used in TOC entries.

Changes Made

  • Add the extractTextWithoutCertainTags function to accept an array of tag names ($ignoredTags) that should be excluded during text extraction.
  • Updated the TOC generation logic to use this function, passing an array with the tag 'sup', ensuring that footnotes are not included in the TOC entries.
  • The addition of this function increases the flexibility of the TOC generation process, allowing for cleaner TOC entries especially in documents where headers contain additional tags like footnotes or other annotations.

Impact

  • These changes allow for more readable and relevant TOC entries by excluding non-essential information (like footnotes) from the headers.
  • The implementation maintains backward compatibility insofar as it only affects the presence of footnotes in the TOC. For users who do not include footnotes in headers or do not utilize the new exclusion feature, the TOC functionality remains unchanged.

This reads the text of a node and all subnodes, but ignores the text of the passed node types including subnodes.

This function is then also used accordingly in the `getList` function.
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