Skip to content

Conversation

@zampino
Copy link
Contributor

@zampino zampino commented Apr 10, 2024

This is a minimal proposal for allowing the current internal implementation to customize inline parsing of special characters, following @robinst advice to provide a starting POC :-).

I quickly tested this in combination with Parser.Builder.inlineParserFactory in the context of a clojure application for parsing inline latex delimited between pairs of $ characters, but proper testing is still missing. It's a first step to see what's possible, far from providing enough fine-grained customization.

Addresses #263. Closes #317.

Copy link
Collaborator

@robinst robinst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So in order for users to actually use this, the configuration needs to be on the Parser.Builder, similar to custom block parsers. Then when constructing the inline parser, pass it in the constructor.

(We will also need to move some classes into an exported package, but can do that later.)

}

public InlineParser addInlineParser(Character c, List<InlineContentParser> parsers) {
this.inlineParsers.put(c, parsers);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this will currently override any existing built-in parsers with that same special character. I think we should do the same thing as for block parsers, see

public Builder customBlockParserFactory(BlockParserFactory blockParserFactory) {

So try the custom parsers first. The custom parser can decide not to handle something, in which case the built-in parsers are tried next.

@robinst
Copy link
Collaborator

robinst commented Apr 26, 2024

@robinst robinst closed this Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Question: How to extract original source between delimiters in a delimiterProcessor?

2 participants