{"id":16683862,"url":"https://github.com/meniny/highlightjs.swift","last_synced_at":"2025-04-09T23:25:25.361Z","repository":{"id":45901910,"uuid":"97915663","full_name":"Meniny/HighlightJS.swift","owner":"Meniny","description":"✨A code syntax highlight library using Highlight.js","archived":false,"fork":false,"pushed_at":"2017-07-21T11:05:06.000Z","size":589,"stargazers_count":19,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-07T12:16:18.217Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Meniny.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-21T06:47:38.000Z","updated_at":"2024-03-11T09:54:33.000Z","dependencies_parsed_at":"2022-09-22T20:23:03.024Z","dependency_job_id":null,"html_url":"https://github.com/Meniny/HighlightJS.swift","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meniny%2FHighlightJS.swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meniny%2FHighlightJS.swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meniny%2FHighlightJS.swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meniny%2FHighlightJS.swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Meniny","download_url":"https://codeload.github.com/Meniny/HighlightJS.swift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248127615,"owners_count":21052258,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T14:26:54.778Z","updated_at":"2025-04-09T23:25:25.338Z","avatar_url":"https://github.com/Meniny.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HighlightJS.swift\n\n## What's this?\n\n`HighlightJS.swift` is a code syntax highlight library using [Highlight.js](https://highlightjs.org).\n\nSupports 169 languages and 80 themes.\n\n![preview](https://i.loli.net/2017/07/21/5971dd1e177bd.jpg)\n\n![preview](https://i.loli.net/2017/07/21/5971dd3cda847.jpg)\n\n## Requirements\n\n* iOS 8.0+\n* macOS 10.11+\n* tvOS 9.0+\n* Xcode 8 with Swift 3\n\n## Installation\n\n#### CocoaPods\n\n```ruby\npod 'HighlightJS'\n```\n\n## Contribution\n\nYou are welcome to fork and submit pull requests.\n\n## License\n\n`HighlightJS.swift` is open-sourced software, licensed under the `MIT` license.\n\n## Usage\n\n#### HighlightJS\n\n```swift\nlet textStorage = HighlightJSAttributedString()\n\nlet layoutManager = NSLayoutManager()\ntextStorage.addLayoutManager(layoutManager)\n\nlet textContainer = NSTextContainer(size: CGSize.zero)\nlayoutManager.addTextContainer(textContainer)\n\nlet textView = UITextView(frame: rect, textContainer: textContainer)\nview.addSubview(textView)\n\nvar highlighter = textStorage.highlightJS\n\ntextStorage.language = HighlightJS.LanguageName.rawValue // \"swift\"\ntextStorage.highlightJS.setTheme(to: HighlightJS.ThemeName.rawValue) // \"solarized-light\"\n\ntextView.text = \"func test() {}\"\n```\n\n#### HighlightView (1.1.0+, iOS only)\n\n```swift\nlet h = HighlightView(frame: rect)\nview.addSubview(h)\nh.language = .swift\nh.theme = .solarizedLight\nh.text = \"func test() {}\"\n```\n\n***\n\n\u003e Checkout the sample project for more detail.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeniny%2Fhighlightjs.swift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeniny%2Fhighlightjs.swift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeniny%2Fhighlightjs.swift/lists"}