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

[Snyk] Upgrade markdown-it-table-of-contents from 0.6.0 to 0.7.0 #6

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

Conversation

AlphaBeta906
Copy link
Owner

snyk-top-banner

Snyk has created this PR to upgrade markdown-it-table-of-contents from 0.6.0 to 0.7.0.

ℹ️ Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.


  • The recommended version is 1 version ahead of your current version.

  • The recommended version was released on 22 days ago.

Release notes
Package name: markdown-it-table-of-contents
  • 0.7.0 - 2024-09-09
    • Added: Override the container element
    • ⚠️ BREAKING CHANGE: The plugin moved from inline mode to block mode (fixes #62)
    • Changed: Updated tests, readme etc.
    • Removed: Old forceFullToc attribute

    Override the container element

    Two new options that accept functions that return HTML to render custom containers (and more elements if necessary):

    md.use(markdownItTOC, {
        transformContainerOpen: () => {
            return '<nav class="my-toc"><button>Toggle</button><h3>Table of Contents</h3>';
        },
        transformContainerClose: () => {
            return '</nav>';
        }
    });

    Inline mode is now block mode

    Input:

    [[toc]]

    Output before:

    <p><div class="table-of-contents"></div></p>

    Output now:

    <div class="table-of-contents"></div>

    The TOC now is generated in block mode, which removes the wrapping p tag. Wrapping a div in a p is considered invalid HTML.

    If you really need a wrapping p-element, you can emulate the old behavior with the new container override functions:

    const md = new MarkdownIt();
    md.use(markdownItTOC, {
        transformContainerOpen: () => {
            return '<p><div class="table-of-contents">';
        },
        transformContainerClose: () => {
            return '</div></p>';
        }
    });

    Be aware that the old tests/examples now behave differently when using soft breaks before the [[toc]] markup:

    Input:

    # Article

    Text with soft line break (two spaces)
    [[toc]]

    ## Headline

    Output before:

    <h1>Article</h1>
    <p>Text with soft line break (two spaces)<br>
    <div class="table-of-contents">...</div></p>

    Output now:

    <h1>Article</h1>
    <p>Text with soft line break (two spaces)</p>
    <div class="table-of-contents">...</div>
  • 0.6.0 - 2021-11-12

    The TOC generator was rewritten, because the old on-the-fly generator couldn't deal with unexpected order of headings and double-indentations. It is now a three-step process:

    1. Gather all headings in a list.
    2. Turn that list into a nested tree.
    3. Generate HTML code based on the nested tree.

    Although all tests pass, this release could introduce some breaking changes for you, if you relied on the old way of doing things. Check the test cases to get a better understanding how this plugin handles various cases.

    • Added: Support for markdown-it-attrs (fixes #54)
    • Changed: Respects unexpected nesting order (fixes #55)
    • Changed: Uses anchor targets from existing id attributes (for example, set by markdown-it-attrs or markdown-it-anchor)
    • Changed: Now nests list correctly if there is a jump (for example: h2, h2, h4 -> h4 is now double-indented)
    • Removed: unused tests
from markdown-it-table-of-contents GitHub release notes

Important

  • Check the changes in this PR to ensure they won't cause issues with your project.
  • This PR was automatically created by Snyk using the credentials of a real user.

Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

For more information:

Snyk has created this PR to upgrade markdown-it-table-of-contents from 0.6.0 to 0.7.0.

See this package in npm:
markdown-it-table-of-contents

See this project in Snyk:
https://app.snyk.io/org/alphabeta906/project/6a5b251a-28f3-4de3-b34e-c87e7d56b36e?utm_source=github&utm_medium=referral&page=upgrade-pr
Copy link

netlify bot commented Oct 1, 2024

Deploy Preview for uniteduniversalnations ready!

Name Link
🔨 Latest commit 40c4fc9
🔍 Latest deploy log https://app.netlify.com/sites/uniteduniversalnations/deploys/66fbcee447ac940008feffa7
😎 Deploy Preview https://deploy-preview-6--uniteduniversalnations.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 90
Accessibility: 98
Best Practices: 100
SEO: 100
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants