{"id":15467699,"url":"https://github.com/uranusjr/prism-objc","last_synced_at":"2025-04-11T11:31:46.963Z","repository":{"id":25191484,"uuid":"28614960","full_name":"uranusjr/Prism-objc","owner":"uranusjr","description":"Objective-C Wrapper for Prism (the JavaScript syntax highlighter) using JavaScriptCore","archived":false,"fork":false,"pushed_at":"2015-01-01T05:05:58.000Z","size":220,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T13:38:48.267Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","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/uranusjr.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":"2014-12-30T02:42:35.000Z","updated_at":"2021-12-23T09:10:36.000Z","dependencies_parsed_at":"2022-08-23T18:00:58.627Z","dependency_job_id":null,"html_url":"https://github.com/uranusjr/Prism-objc","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/uranusjr%2FPrism-objc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uranusjr%2FPrism-objc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uranusjr%2FPrism-objc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uranusjr%2FPrism-objc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uranusjr","download_url":"https://codeload.github.com/uranusjr/Prism-objc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248383993,"owners_count":21094652,"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-02T01:24:07.666Z","updated_at":"2025-04-11T11:31:46.563Z","avatar_url":"https://github.com/uranusjr.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Prism-objc\n\nObjective-C Wrapper for Prism (the JavaScript syntax highlighter) using JavaScriptCore.\n\n## What?\n\n[Prism] is a “lightweight, robust, elegant syntax highlighting library” that renders code snippets into syntax highlighted HTML. It is created by [Lea Verou], written in JavaScript, and is based on regular expression.\n\nThis library/framework uses [JavaScriptCore] to perform so-called “server-side rendering” with Prism. It supports most modern OS X versions (I’m not very sure how far back this goes, but at least 10.7+ should be fine) and iOS 7 or later.\n\n## How?\n\nQuick example:\n\n```obj-c\n#import \u003cPrism/Prism.h\u003e\n\n// ...\n\nPRISyntaxHighlighter *highlighter = [[PRISyntaxhighlighter alloc] initWithDefaultAliases:YES];\nNSString *output = [highlighter highlight:@\"int\" asLanguage:@\"objc\" error:NULL];\nNSLog(@\"%@\", output);   // \u003cspan class=\"token keyword\"\u003eint\u003c/span\u003e\n```\n\nThe main class is `PRISyntaxHighlighter`. It constructs Prism internally when `init` it. After that, you can use `-highlight:asLanguage:error:` to highlight code snippets.\n\nThe language names you pass into when you perform highlighting need to be one of the followings:\n\n1. A built-in definition that is a key of `-languages`.\n2. One of the language aliases that is a key of `-aliases`.\n\nYou can add/remove aliases using `-addAlias:forName:`, `-addAliasesFromDictionary:`, and `-removeAlias:`. An alias should point to a built-in language name, or another alias.\n\nA set of recommended aliases is provided via `+defaultAliases`. Note that they are *not* loaded if you use `init` to initialise `PRISyntaxHighlighter`.\n\nPrism provides some built-in styling. You can get a set of themes and URLs pointing to their respective CSS files via `-themes`.\n\n## Demo\n\nThere’s a demo project in the `PrismDemo` directory showing what this library can do. You can build it on OS X in Xcode by opening `Prism.xcworkspace` and run the *PrismDemo* scheme.\n\n![Choose “PrismDemo” before you hit “Run”](http://d.pr/i/1gBPZ+)\n\n![PrismDemo highlighting PRISyntaxHighlighter API](http://d.pr/i/15v8Z+)\n\n## Installing\n\nThis repository can build as an OS X framework that you can use directly. Alternatively you can also install via [CocoaPods]:\n\n    pod install Prism\n\nSince the original Prism needs to be bundled with the main application, I don’t recommend you just try to include this as a submodule or even copy-paste the code. You will need to structure your project very carefully so that resources can be found correctly. It can work, but you’ll waste a lot of time to this.\n\n## TODO\n\n* Support built-in Prism plugins.\n* Support external Prism plugins.\n* Travis CI.\n* Test Coverage.\n* Proper documentation.\n\n\n[Prism]: http://prismjs.com/\n[Lea Verou]: http://lea.verou.me/\n[JavaScriptCore]: https://www.webkit.org/projects/javascript/\n[CocoaPods]: http://cocoapods.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furanusjr%2Fprism-objc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Furanusjr%2Fprism-objc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furanusjr%2Fprism-objc/lists"}