Closed Southpaw1496 closed 2 years ago
Thank you for pointing this out, I agree. Heading text should be bigger than paragraph text and decrease in size as you go from #
to ####
.
As far as implementing, I think I have a solution? I'll take a look sometime in the next week.
Thank you.
It should be noted that technically HTML header tags (and therefore Markdown headers) go down to six, but if your solution wouldn't allow for that, four is plenty.
Hi @kyle-n, is it possible to add a new formatting rule to adjust font size? Formatting
rule to change the font size.
Just a suggestion :)
You can create your own Regex matches for different headings and set different formatting for each one.
e.g.
private let headingOneRegex = try! NSRegularExpression(pattern: "^#\\s.*$", options: [.anchorsMatchLines])
...
HighlightRule(pattern: headingOneRegex, formattingRules: TextFormattingRule(key: .font, value: SystemFont.systemFont(ofSize: 24)))
...
Works well for me. 🙂
Released with v2.1.0
Is your feature request related to a problem? Please describe.
When using Markdown in HighlightedTextEditor, it's irritating how headings aren't bigger than emboldened text, just very slightly more spaced out. It's also irritating how the number of #s doesn't change the size of the heading, so
# Heading 1
is no bigger than#### Heading 4
.Describe the solution you'd like
It would be nice if headings could actually be bigger/smaller than regular body text. I'm not familiar enough with either the library or Swift to know if this is possible with the current approach or simply out of scope for the project, but it would be nice to have it, to make the markdown highlighting more full-fledged.
Describe alternatives you've considered
N/A
Additional context
As I said, I'm not very familiar with Swift or the library, but SwiftUI has some presets for different font sizes, maybe whatever framework you're using for HighlightTextEditor has something similar that you could use?