Coder Social home page Coder Social logo

Comments (7)

jgm avatar jgm commented on May 29, 2024

Can see same thing with

[hi]({#ab})

[hi]({.ab})

from djot.js.

jgm avatar jgm commented on May 29, 2024

When we match a destination, we (inlines.ts l. 440)

        // convert all matches inside destination to str

The problem is that the attribute parser gives us events for key and value, but not for the =; similarly for the identifier or class, but not the markers # or .. Interior whitespace is also not given an event, so it too will be lost:

% ./djot          
[hi]({a=b c=d})
<p><a href="{abcd}">hi</a></p>

Probably the best fix is to use a different strategy for matching destinations. You might ask, why not just use the position after the ( as the start of the destination and the position before the ) as the end? Because the destination might be broken up by newlines and thus might not occupy a contiguous segment of the input text.

from djot.js.

jgm avatar jgm commented on May 29, 2024

One idea for fixing this would be to have the events parser create multiple +destination/-destination pairs when the URL is split over lines.
parse.ts could then look for multiple destinations and concatenate them. If we were sure that each +destination/-destination pair was on a single line, we could just take all the text between the start and the end.

from djot.js.

jgm avatar jgm commented on May 29, 2024

Reopening; I had to revert the fix because it was buggy.
See #64.

from djot.js.

jgm avatar jgm commented on May 29, 2024

I think the problem is with strMatches in inlines.ts.

from djot.js.

jgm avatar jgm commented on May 29, 2024

Similar issue: [link]({.class})

from djot.js.

jgm avatar jgm commented on May 29, 2024

The function converts all matches to str, but some of the characters, like ., don't generate match events, so they are lost.

from djot.js.

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.