Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Exclude Specific Tags When Extracting Text for TOC Entries #18

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PxaMMaxP
Copy link

@PxaMMaxP PxaMMaxP 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.

None yet

1 participant