Skip to content

TOC generation does not work properly when document headers have parens #383

@fmenozzi

Description

@fmenozzi

Description

When calling :WikiTocGenerate on a document whose header has parens, the parens are not URL-encoded and thus conflict with the markdown link syntax []().

Minimal working example

Suppose you have a document like so:

# Title (with parens)

## Heading

## Another Heading

Calling :WikiTocGenerate will produce the following TOC:

Contents:
* [Title (with parens)](#Title (with parens))
    * [Heading](#Title (with parens)#Heading)
    * [Another Heading](#Title (with parens)#Another Heading)

# Title (with parens)

## Heading

## Another Heading

These links produced in the TOC will not work when using Enter to try and follow them.

I believe the solution would simply be to URL-encode ( and ) in header names when generating the TOC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions