homebrewery
homebrewery copied to clipboard
[Editor] Change folded code text generation
This PR will resolve #1907.
This PR modifies the text generated when code is folded, using the following rules:
- Use the first header in the folded section. At this point, a
h6
at the top of the fold will be used over a laterh1
. - If no headers exist, use the text of the first non-empty line.
- If no non-empty lines exist, generate text "Lines {start line}-{end line}"
Example output:
Folded:
Brew Source:
# Combat Maneuvers
\page
# Combat Actions
\page
## Movement
\page
## Defense
\page
## Special Targeting
\page
# Footnotes on source rules
\page
### Parry Defence
\page
## Other options/wrinkles
\page
### Weapon Length and Positioning
\page
## Damage-type Maneuvers
\page
## No Quarter <small>Combat manuevers - for fighting</small>
\page
\page
This is a test page.
This is the second line.
\page
This is a test page.
This is the second line.
### Header later on
\page
As per the comments on #1907, I've added a color
attribute to the LESS for the fold-marker, changing it from blue to grey.
In this example, I've folded all of the code, then re-opened one to make sure that the heading (and it's color) is visible.
This seems fine to me now. Any objection to merging @G-Ambatte ?
I've converted to an actual PR instead of a Draft, so it should be ready to merge!
:cook: 🤌