8000 How to avoid delimiter conflict with other nodes? · Issue #371 · commonmark/commonmark-java · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
How to avoid delimiter conflict with other nodes? #371
Open
@le-tyang

Description

@le-tyang

Background

We have a custom format for providing extra attributes to a piece of content.

Example format as

^[CONTENT](Attributes go here)

The reason behind using this format is because it is supported out-of-box from iOS which we do understand it is NOT part of commonmark.

After few attempts, we got there, like 90%.

Problem

We found out that when the content is in certain format, the parser takes Link parsing as higher priority and render it as

Image

content as

This is considered as a LINK somehow
 ^[NoAttributes]( 'u': 'underline' ) suffix

I believe this is cause by Link parse runs first?

Help needed

Would like to get some help on this issue to see either we can:

  1. Change priority of parsing
  2. Configure Link parser to ignore ^[]() format.

Any suggestion would be helpful.

Snippet

    class AttributesDelimiterProcessor: DelimiterProcessor {
        override fun getOpeningCharacter(): Char = '^'
        override fun getClosingCharacter(): Char = ')'
        override fun getMinLength(): Int = 1

        override fun process(
            openingRun: DelimiterRun?,
            closingRun: DelimiterRun?
        ): Int {
           // Seems like doesn't matter how you'd process it.
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0