You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
I'm trying to implement parsing of Special GitLab References
Specifically those ones, where only starting delimiter exists: ~bug ~"Multiple word fea"
How can i do this?
I've already tried DelimiterProcessor but it seems not to support such cases.
Also, i've tried to implement custom BlockParser but it looks like it's consuming the whole line and does not give default parsers ability to do their work.
Seems that it is because of this code inside DocumentParser:
while (tryBlockStarts) {
...
tryBlockStarts = newBlockParser.isContainer();
Does it mean that i can not use BlockParser for this purpose?
Is there any way to implement InlineParser extension?
As I can see, currently library gives me two ways:
Implement own InlineParser. This way seems like an overengineering and too hard for such small feature.
Do not extend parsing at all and iterate over AST to find Text nodes and replace necessary parts with custom nodes. This way seems a bit hacky.
Unfortunately I do not see a native way to implement what you have in mind due to somewhat limited nature of InlineParser in commonmark-java. There is an issue that have this concern addressed: #113. But it's still open and I'm not sure if someone is working on it.
But this functionality certainly can be achieved. In sample-custom-extension I have demonstrated how this could be done. In short:
pre-proccess raw markdown
find desired components and wrap then with delimiters (from start and at the end)
register custom DelimiterProcessor that will handle you components
override visitor to handle CustomNode and apply a span
I know it might be not optimal solution but so far I know no other ways. But let's see how issue in commonmark-java will change, maybe it will be super trivial soon.
Hello!
I'm trying to implement parsing of Special GitLab References
Specifically those ones, where only starting delimiter exists:
~bug ~"Multiple word fea"
How can i do this?
I've already tried
DelimiterProcessor
but it seems not to support such cases.Also, i've tried to implement custom
BlockParser
but it looks like it's consuming the whole line and does not give default parsers ability to do their work.Seems that it is because of this code inside
DocumentParser
:Does it mean that i can not use
BlockParser
for this purpose?Is there any way to implement
InlineParser
extension?As I can see, currently library gives me two ways:
InlineParser
. This way seems like an overengineering and too hard for such small feature.Text
nodes and replace necessary parts with custom nodes. This way seems a bit hacky.Same question in commonmark-java repo
The text was updated successfully, but these errors were encountered: