GithubHelp home page GithubHelp logo

Comments (2)

laobubu avatar laobubu commented on August 25, 2024

To unstyle invalid bare links, the doc must be thoroughly parsed. However in CodeMirror, styling is an one-pass ( to keep the editor effective ). When a possible bare link appears , HyperMD assumes it's valid because it can't look ahead for the link definition footnotes.

However, this feature is still implementable by creating an add-on . The add-on shall check every visible bare links and unstyle the invalid ones via "markText" API . But this could be very slow, if the document is big.

Currently there's no plan to implement this.

from hypermd.

peey avatar peey commented on August 25, 2024

I was thinking that another strategy for this could be that we maintain a map of registered links where keys are the text within [...] and the link is specified.

Also maintain an index of all [.*] elements (let's call them tags, HyperMD must already do this since it styles them)

Now by default, assume that [...] doesn't refer to a link (because it's often used as a bracket in text).

On every text change, scan just the changed parts and update the map. Map updates wouldn't happen during regular text editing, this would only happen when you specifically write or edit a line which looks like the following

[tag]: some link

And if the map was updated, just go through the index in the background and update the required links (HyperMD must be already doing this too, since it provides a tooltip on hovering over the link)

However, I'm not actually familiar with structure of either CodeMirror or HyperMD so I don't know if this strategy is actually implementable. But if it's possible to just process the changed content instead of whole doc then it won't be necessary to scan the whole document every time

from hypermd.

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.