Skip to content

links replacing # with h1 due to markdown #100

@roskelld

Description

@roskelld

I was looking for a solution to add blog posts to my GitHub site and here we are.

When testing out my own code and the hosted demo code I noticed that URLs with a # (so, all hosted pages) are replaced by <h1> in the rendered URL.

Example:
Go to the demo post
http://chris-diana.com/cms.js/demo/#/posts/2017-08-20-another-example-post

The link in the body text goes to:
http://chris-diana.com/cms.js/demo/<h1>

I'm guessing that the markdown https://github.com/chrisdiana/cms.js/blob/develop/src/markdown.js is picking up the # as a heading.

// headers - fix link anchor tag regex
{regex: /(#+)(.*)/g, replacement: (text, chars, content) => {
        var level = chars.length;
        return '<h' + level + '>' + content.trim() + '</h' + level + '>';
}},

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