-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a theme/language enum? #38
Labels
Comments
Here's an extension that makes this work: extension Highlightr {
enum Theme: String {
case arta = "arta"
case atelierCaveDark = "atelier-cave-dark"
case atelierCaveLight = "atelier-cave-light"
case dracula = "dracula"
case pojoaque = "pojoaque"
case solarizedDark = "solarized-dark"
case solarizedLight = "solarized-light"
case xcode = "xcode"
}
enum Language: String {
case css = "css"
case html = "html"
}
@discardableResult
func setTheme(to theme: Highlightr.Theme) -> Bool {
return setTheme(to: theme.rawValue)
}
func highlight(_ code: String, as language: Highlightr.Language, fastRender: Bool = true) -> NSAttributedString? {
return highlight(code, as: language.rawValue, fastRender: fastRender)
}
} My comment about it requiring a version bump and being a breaking change is incorrect. It could be an additional API and we can deprecate the old usage with |
I like this a lot! Awesome idea :). |
Sweet! I'll try and get a PR up soon. If someone else wants to feel free. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What are your thoughts on providing a theme enum? There are 79 styles/themes currently, so it'll be a pretty large enum, but it seems like it would make the API a little more swifty.
ex:
And setting a theme would look like:
Thinking about it more, we'd probably want to do the same for languages (176 currently) if bothering to make this change. It wouldn't be backward compatible and require a full version bump.
The text was updated successfully, but these errors were encountered: