{"id":2036,"url":"https://github.com/ruddfawcett/Notepad","last_synced_at":"2025-08-06T14:32:53.811Z","repository":{"id":46107685,"uuid":"70966116","full_name":"ruddfawcett/Notepad","owner":"ruddfawcett","description":"[iOS] A fully themeable markdown editor with live syntax highlighting.","archived":false,"fork":false,"pushed_at":"2021-11-14T10:26:25.000Z","size":328,"stargazers_count":880,"open_issues_count":13,"forks_count":106,"subscribers_count":26,"default_branch":"master","last_synced_at":"2024-12-04T07:04:28.504Z","etag":null,"topics":["cocoapods","ios","markdown","notepad","regex","syntax-highlighter","theme","uitextview"],"latest_commit_sha":null,"homepage":"http://rudd.fyi/notepad","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/ruddfawcett.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-15T04:30:07.000Z","updated_at":"2024-11-18T02:41:07.000Z","dependencies_parsed_at":"2022-08-25T18:02:23.281Z","dependency_job_id":null,"html_url":"https://github.com/ruddfawcett/Notepad","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruddfawcett%2FNotepad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruddfawcett%2FNotepad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruddfawcett%2FNotepad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruddfawcett%2FNotepad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruddfawcett","download_url":"https://codeload.github.com/ruddfawcett/Notepad/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228915455,"owners_count":17991409,"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":["cocoapods","ios","markdown","notepad","regex","syntax-highlighter","theme","uitextview"],"created_at":"2024-01-05T20:16:01.805Z","updated_at":"2024-12-09T15:30:49.070Z","avatar_url":"https://github.com/ruddfawcett.png","language":"Swift","readme":"![](https://cdn.rawgit.com/ruddfawcett/Notepad/master/resources/header.svg)\n\n[![Version](https://img.shields.io/github/release/ruddfawcett/Notepad.svg)](https://github.com/ruddfawcett/Notepad/releases) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![CocoaPods compatible](https://img.shields.io/cocoapods/v/Notepad.svg)](https://cocoapods.org/pods/Notepad)\n\n## Usage\n\n```swift\nlet notepad = Notepad(frame: view.bounds, themeFile: \"one-dark\")\nview.addSubview(notepad)\n```\nNotepad is just like any other UITextView, but you need to use the convenience initializer in order to use the themes. To create a new theme, copy one of the existing themes and edit the JSON.\n\nCheck out the [Xcode project](Example.xcodeproj) for an [example](Example). For full documentation read [the code](Notepad/Notepad.swift).\n\n### Extending an Existing Text View with Notepad Features\n\nIf you cannot work with the `Notepad` subclass directly for some reason, you can set up an existing `UITextView` or `NSTextView` on your own.\n\nFor iOS, you have to initialize all TextKit components yourself. Take the following as a blueprint where you can swap in custom objects:\n\n```swift\nclass ViewController: UIViewController {\n    var textView: UITextView!\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n\n        let containerSize = CGSize(width: self.view.bounds.width, height: CGFloat.greatestFiniteMagnitude)\n        let container = NSTextContainer(size: containerSize)\n        container.widthTracksTextView = true\n\n        let layoutManager = NSLayoutManager()\n        layoutManager.addTextContainer(container)\n\n        let storage = Storage()\n        let theme = Theme(\"one-dark\")\n        storage.theme = theme\n        storage.addLayoutManager(layoutManager)\n\n        let editor = UITextView(frame: self.view.bounds, textContainer: container)\n        editor.backgroundColor = theme.backgroundColor\n        editor.tintColor = theme.tintColor\n        editor.autoresizingMask = [.flexibleWidth, .flexibleHeight]\n    }\n}\n\n\n```\n\nAnd for macOS:\n\n```swift\nclass ViewController: NSViewController {\n    @IBOutlet var textView: NSTextView!\n    let storage = Storage()\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n\n        let theme = Theme(\"one-dark\")\n        storage.theme = theme\n        textView.backgroundColor = theme.backgroundColor\n        textView.insertionPointColor = theme.tintColor\n        textView.layoutManager?.replaceTextStorage(storage)\n    }\n}\n```\n\n\n## Themes\n\nTake a look at all of the [themes and swatches](themes.md) when choosing the theme for your Notepad, or as inspiration for a new one.\n\nYou can find all of the raw themes in the [themes folder](Notepad/themes), and the file names are case-sensitive.\n\n### Custom Regex\nUsing regex, you can match custom patterns in your Notepad editor by passing a `regex` attribute in your theme. For example, one that highlights Twitter handles in a teal color:\n\n```json\n\"handle\": {\n  \"regex\": \"[@＠][a-zA-Z0-9_]{1,20}\",\n  \"color\": \"#78ddd5\"\n}\n```\n\n## Installation\n\nCopy the source from the Notepad folder to your project, or add Notepad to your Podfile if you're using CocoaPods.\n","funding_links":[],"categories":["Libs","Text","UI","Swift","Text [🔝](#readme)"],"sub_categories":["Text","Other free courses","Layout","Other Testing","Keychain"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruddfawcett%2FNotepad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruddfawcett%2FNotepad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruddfawcett%2FNotepad/lists"}