Giter Club home page Giter Club logo

Comments (5)

johansatge avatar johansatge commented on August 24, 2024

Hi,

this is "expected" in the current implementation because markdown characters (*_ etc) are naively stripped from the link text, as it's not possible to have styles there (see Known issues in the readme)

But there are probably possible improvements, feel free to share methods to strip markdown characters in a more efficient way 🙏

from obsidian-automatic-table-of-contents.

didierGuieu avatar didierGuieu commented on August 24, 2024

what do you use to strip the markdown characters ?

from obsidian-automatic-table-of-contents.

johansatge avatar johansatge commented on August 24, 2024

const stripMarkdown = (text) => {
text = text.replaceAll('*', '').replaceAll('_', '').replaceAll('`', '')
text = text.replaceAll('==', '').replaceAll('~~', '')
text = text.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1') // Strip markdown links
return text
}

from obsidian-automatic-table-of-contents.

didierGuieu avatar didierGuieu commented on August 24, 2024

If I clearly understand text is the whole header.
Something strange in Obsidian is that all the code are interpreted inside the word except the underscore.
Perhaps, we could strip the underscore in a different way by removing them only at the begining or the end of the word.
Another solution should be to support the escape code and only remove the escape code and keeping the caracter after.
Need some other thoughts about it and how to do it in JS.

from obsidian-automatic-table-of-contents.

didierGuieu avatar didierGuieu commented on August 24, 2024

Last option but the simpler : Adding an option inside the toc for discarding the MD code or not inside the link.
Surely the simpliest solution

from obsidian-automatic-table-of-contents.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.