mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-06-05 06:49:56 +08:00
* add multiplier based on device text size * adjust settings labels * syntax highlighting supported
25 lines
552 B
Swift
25 lines
552 B
Swift
//
|
|
// GithubHighlighting.swift
|
|
// Freetime
|
|
//
|
|
// Created by Ryan Nystrom on 11/25/17.
|
|
// Copyright © 2017 Ryan Nystrom. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import Highlightr
|
|
|
|
enum GithubHighlighting {
|
|
|
|
private static var shared: Highlightr? = {
|
|
let h = Highlightr()
|
|
h?.setTheme(to: "github", fontSize: Styles.Sizes.Text.code)
|
|
return h
|
|
}()
|
|
|
|
static func highlight(_ code: String, as language: String) -> NSAttributedString? {
|
|
return shared?.highlight(code, as: language, fastRender: true)
|
|
}
|
|
|
|
}
|