[Feat] Add support for pandoc fenced divs and bracketed spans#5848
[Feat] Add support for pandoc fenced divs and bracketed spans#5848benniekiss wants to merge 6 commits into
Conversation
62579f0 to
38b3aca
Compare
37a4e85 to
7cd6e16
Compare
ff2c762 to
5a245c0
Compare
|
This PR is quite large, but I think I'll focus on this one next. I'll give you some time to update it, though, first :D |
|
It really has! I'm happy to split it into two, the renderer/parser and then the UI components, but otherwise, I'll get it rebased today |
ff3b184 to
ae9ecca
Compare
|
Should be pretty cleaned up at this point.
Otherwise, this has been working well for me! |
11338af to
bbccf3b
Compare
|
Wonderful! I've been struggling in the past week to maybe give this PR the attention it deserves, but given that I'm still full throttle in application cycle I think to make it faster splitting it up might help so that I can give better feedback, if that works for you? I think having this support is nice in 4.0! |
|
That definitely works! I'll have this split into parsing/rendering and UI components sometime later today or tomorrow. |
Description
This PR adds a popover toolbar item to insert Pandoc fenced divs or bracketed spans with the configured identifier, classes, and attributes. Two tools, highlight and underline, are added to the formatting toolbar related to bracketed spans to help illustrate the functionality.This PR implements parsing and rendering for Pandoc fenced divs and bracketed spans, and it includes several utilties and functions to make use of them.
Changes
An inline parser using delimiters was added for bracketed spans, and a composite block parser was added for fenced divs.
A renderer was added which assigns the attributes as a
markdecoration.A popover is added to the toolbar which provides three input forms to configure an identifier, classes, and attributes to assign to the fenced div or bracketed span. Fenced Divs or Bracketed Spans can be selected with the tab bar at the top of the popover, and they are inserted via the button at the bottom.
I chose the
drag-handleicon since it is similar to the:::fence syntax, but I am open to any suggestions for a different one.The formatting toolbar was filled out with highlighting, strikethrough, and underline functions.
The highlighting format character was made configurable, so users can configure whether to use spans or
==as the highlight mark.Additional information
I was inspired by the Quarto editor's similar functionality.
The one remaining issue I have is that I can't seem to revert the
background-colorfor the lines containing the div formatting characters. I think it's some nesting issue, but I have not found a way to fix it.Images
Rendering:

Hiding formatting characters:

Inserting a div:

The inserted div and formatting bar:

Tested on:
macOS 15.6