mirror of
https://github.com/swiftbar/SwiftBar.git
synced 2024-10-27 00:50:16 +03:00
Markdown processing should be optional #253
This commit is contained in:
parent
453e1bb1aa
commit
4c3522f317
@ -127,6 +127,7 @@ echo "Line 1 \\n Line2 | size=8"
|
|||||||
| `sfcolor` | CSS color or HEX, `light_color,dark_color` | Sets SF Symbol color. If only one color is provided, it is used for both light and dark appearance. If you fame multiple SF Symbols you can provide different colors by adding index, like this `sfcolor2` |
|
| `sfcolor` | CSS color or HEX, `light_color,dark_color` | Sets SF Symbol color. If only one color is provided, it is used for both light and dark appearance. If you fame multiple SF Symbols you can provide different colors by adding index, like this `sfcolor2` |
|
||||||
| `font` | macOS font name | Sets font name to use in item text |
|
| `font` | macOS font name | Sets font name to use in item text |
|
||||||
| `size` | Number | Sets item text size |
|
| `size` | Number | Sets item text size |
|
||||||
|
| `md` | True | Enables markdown support in menu title for `**bold**` and `*italic*` |
|
||||||
| `sfsize` | Number | Sets size for SF Symbol image embedded in text|
|
| `sfsize` | Number | Sets size for SF Symbol image embedded in text|
|
||||||
| `length`| Number | Trims item text to a provided number of characters. The full title will be displayed in a tooltip. |
|
| `length`| Number | Trims item text to a provided number of characters. The full title will be displayed in a tooltip. |
|
||||||
| `trim` | True | Trims whitespace characters |
|
| `trim` | True | Trims whitespace characters |
|
||||||
|
@ -539,7 +539,7 @@ extension MenubarItem {
|
|||||||
style.alignment = .left
|
style.alignment = .left
|
||||||
|
|
||||||
var attributedTitle = NSMutableAttributedString(string: title)
|
var attributedTitle = NSMutableAttributedString(string: title)
|
||||||
if #available(macOS 12, *), let parsedMD = try? NSAttributedString(markdown: title) {
|
if #available(macOS 12, *), params.md, let parsedMD = try? NSAttributedString(markdown: title) {
|
||||||
attributedTitle = NSMutableAttributedString(attributedString: parsedMD)
|
attributedTitle = NSMutableAttributedString(attributedString: parsedMD)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +102,10 @@ struct MenuLineParameters {
|
|||||||
params["font"]
|
params["font"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var md: Bool {
|
||||||
|
params["md"] == "true"
|
||||||
|
}
|
||||||
|
|
||||||
var size: CGFloat? {
|
var size: CGFloat? {
|
||||||
guard let sizeStr = params["size"], let pSize = Int(sizeStr) else { return nil }
|
guard let sizeStr = params["size"], let pSize = Int(sizeStr) else { return nil }
|
||||||
return CGFloat(pSize)
|
return CGFloat(pSize)
|
||||||
|
Loading…
Reference in New Issue
Block a user