Comments (9)
And done!
from prosemirror-markdown.
@marijnh Can you please share some thoughts on how you would implement this?
In the PR mentioned above, you suggested "giving the function that produces the delimiters access to the inline node(s) that the mark applies to."
If I'm understanding correctly, that would mean that when we come across a new mark, we immediately look ahead to find all the following nodes that mark applies to, so we can pass these to the before
function, and we'd keep track of them somehow so we can also pass them to the after
function later. The functions would then look at the text content of these nodes, and compare it to the mark's src
, to determine how to render the link.
Assuming we don't want to make the implementation of this node-tracking too specific to links, how do you imagine us keeping track of these nodes across nested and overlapping marks?
from prosemirror-markdown.
Hm, good question. I think the most reasonable way to support this without adding a lot of complexity or expensive node-enumerating for every mark is to pass the context fragment and index to the callbacks that create the open/close strings. I should have used that for backtick counting as well, I suppose, but unfortunately didn't, so now for backwards compat the interface got kind of clumsy, but that's survivable. Does attached patch look reasonable to you?
from prosemirror-markdown.
Oh, hold on, I never released that backtick patch yet, so I can still break compatibility!
from prosemirror-markdown.
That's better. Let me know if these work for you, and I'll release them.
from prosemirror-markdown.
@marijnh Thanks! The behavior is exactly what I was looking for, so in that sense they certainly work for me.
I still somewhat prefer my own approach at generic support for dynamic delimiters, because it's easier to write before
/after
functions that deal with text content, than with parent
and index
, and we don't end up with a text
argument that's only provided in some cases (escape: false
), but not all, but ultimately that doesn't matter so much because few people will be adding their own marks with dynamic behavior anyway. I also think the logic around expelEnclosingWhitespace
is a lot easier to understand in my version than the current master
, but that may just be me.
Either way, if you release a new version with the patches you've added, I can move forward with https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22797 and I'll be very happy!
from prosemirror-markdown.
we don't end up with a text argument that's only provided in some cases
Since the latest patch, that's no longer the case.
I've released this as 1.3.0
from prosemirror-markdown.
@marijnh Perfect, thank you!
from prosemirror-markdown.
Hold on, I messed something up. Re-doing the release
from prosemirror-markdown.
Related Issues (20)
- Allow list items to start with other nodes than paragraphs HOT 2
- Unnecessary escape for the period (.) character HOT 3
- Inline code with `<` characters does not parse correctly (html inside inline code) HOT 2
- Unnecessary escape for `#` character HOT 2
- expelEnclosingWhitespace not working with inner links HOT 1
- What is the recommended method to update the src/schema.ts configuration in a project? HOT 1
- Mark's aren't serialized if root node isn't a block container HOT 2
- Markdown-It is not ESM HOT 4
- Punycode is now a hard-dependency? HOT 4
- Numbers in headers HOT 1
- Don' escape `+++` at the start of a line when serializing HOT 1
- Markdown parser combines two or more same autolink into a single anchor element HOT 3
- How to use with Tables? HOT 1
- Export default parser/serializer options HOT 2
- symbol | in table cells HOT 2
- Support passing in markdown-it `env` HOT 5
- Fenced code blocks does not check for backticks
- Handling of `softbreak` is weird HOT 4
- HTML entity unescaping on parse can lead to unexpected results on serialize HOT 5
- Add support for passing an extra env dictionary to the `MarkdownSerializer` HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prosemirror-markdown.