flexmark-java icon indicating copy to clipboard operation
flexmark-java copied to clipboard

Allow a way of getting source mapping info for each individual line of a blockquote

Open midrare opened this issue 5 years ago • 0 comments

Is your feature request related to a problem? Please describe. I have a markdown editing app that performs live syntax highlighting, and I want blockquotes to have their leading > characters in bold. To do this, I need to get the source mapping info for each blockquote line. I have subclassed of NodeVisitor and am calling this.addHandler(new VisitHandler<>(BlockQuote.class, this::visit)); so that I can extract the source mapping information from it.

The problem is that the BlockQuote class only allows getting the source map info for the first > in the blockquote (by calling BlockQuote.getOpeningMarker().

If, for example, the full block quote is

> line 1
> line 2
> > line 3
> > line 4
> line 5

Then BlockQuote.getOpeningMarker() only returns source mapping for the first >

**>** line 1      <-- this one
> line 2
> > line 3
> > line 4
> line 5

Describe the solution you'd like I'd like a method like getOpeningMarkers() (plural) to be added to BlockQuote that returns source mapping info for all leading > characters, not just the first.

Describe alternatives you've considered Alternatively, a new Node subclass, BlockQuoteItem, that is to BlockQuote as BulletListItem is to BulletList. Then I can add a VisitHandler just for BlockQuoteItem and handle each item individually.

midrare avatar Aug 18 '20 15:08 midrare