All Projects → ruddfawcett → Notepad

ruddfawcett / Notepad

Licence: mit
[iOS] A fully themeable markdown editor with live syntax highlighting.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Notepad

Anyformatkit
Simple text formatting in Swift
Stars: ✭ 296 (-58.01%)
Mutual labels:  cocoapods, regex, uitextview
Cminputview
💪之前代码是基于UITextView进行的封装,侵入性较强,不方便使用,现使用Category重构代码,支持Cocoapods
Stars: ✭ 149 (-78.87%)
Mutual labels:  cocoapods, uitextview
Cdmarkdownkit
An extensive Swift framework providing simple and customizable markdown parsing.
Stars: ✭ 158 (-77.59%)
Mutual labels:  markdown, cocoapods
Pincodeinputview
A input text view for entering pin code.
Stars: ✭ 108 (-84.68%)
Mutual labels:  cocoapods, uitextview
Uitextfield Navigation
🏄‍♂️ UITextField-Navigation makes it easier to navigate between UITextFields and UITextViews
Stars: ✭ 436 (-38.16%)
Mutual labels:  cocoapods, uitextview
Attributedstring
基于Swift插值方式优雅的构建富文本, 支持点击长按事件, 支持不同类型过滤, 支持自定义视图等.
Stars: ✭ 294 (-58.3%)
Mutual labels:  cocoapods, regex
Ictextview
UITextView subclass supporting string/regex search and highlighting
Stars: ✭ 321 (-54.47%)
Mutual labels:  regex, uitextview
Guitar
A Cross-Platform String and Regular Expression Library written in Swift.
Stars: ✭ 641 (-9.08%)
Mutual labels:  cocoapods, regex
Agemojikeyboard
Emoji Keyboard for iOS
Stars: ✭ 686 (-2.7%)
Mutual labels:  cocoapods
Ripgrep
ripgrep recursively searches directories for a regex pattern while respecting your gitignore
Stars: ✭ 28,564 (+3951.63%)
Mutual labels:  regex
Growingtextview
An UITextView in Swift. Support auto growing, placeholder and length limit.
Stars: ✭ 683 (-3.12%)
Mutual labels:  uitextview
Htmly
Simple and fast databaseless PHP blogging platform, and Flat-File CMS
Stars: ✭ 689 (-2.27%)
Mutual labels:  markdown
Marked
A markdown parser and compiler. Built for speed.
Stars: ✭ 26,556 (+3666.81%)
Mutual labels:  markdown
Ngx Markdown
Angular markdown component/directive/pipe/service to parse static, dynamic or remote content to HTML with syntax highlight
Stars: ✭ 687 (-2.55%)
Mutual labels:  markdown
Electron Markdownify
📕 A minimal Markdown editor desktop app
Stars: ✭ 700 (-0.71%)
Mutual labels:  markdown
Ok Mdx
Browser-based MDX editor
Stars: ✭ 681 (-3.4%)
Mutual labels:  markdown
Backslide
💦 CLI tool for making HTML presentations with Remark.js using Markdown
Stars: ✭ 679 (-3.69%)
Mutual labels:  markdown
Gatsby Gitbook Starter
Generate GitBook style modern docs/tutorial websites using Gatsby + MDX
Stars: ✭ 700 (-0.71%)
Mutual labels:  markdown
Recipes
Django application for managing recipes
Stars: ✭ 695 (-1.42%)
Mutual labels:  markdown
Uiimageview Letters
UIImageView category for using initials as a placeholder image, written in Objective-C. For a Swift implementation, see https://github.com/bachonk/InitialsImageView
Stars: ✭ 694 (-1.56%)
Mutual labels:  cocoapods

Version Carthage compatible CocoaPods compatible

Usage

let notepad = Notepad(frame: view.bounds, themeFile: "one-dark")
view.addSubview(notepad)

Notepad 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.

Check out the Xcode project for an example. For full documentation read the code.

Extending an Existing Text View with Notepad Features

If you cannot work with the Notepad subclass directly for some reason, you can set up an existing UITextView or NSTextView on your own.

For iOS, you have to initialize all TextKit components yourself. Take the following as a blueprint where you can swap in custom objects:

class ViewController: UIViewController {
    var textView: UITextView!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        let containerSize = CGSize(width: self.view.bounds.width, height: CGFloat.greatestFiniteMagnitude)
        let container = NSTextContainer(size: containerSize)
        container.widthTracksTextView = true

        let layoutManager = NSLayoutManager()
        layoutManager.addTextContainer(container)

        let storage = Storage()
        let theme = Theme("one-dark")
        storage.theme = theme
        storage.addLayoutManager(layoutManager)

        let editor = UITextView(frame: self.view.bounds, textContainer: container)
        editor.backgroundColor = theme.backgroundColor
        editor.tintColor = theme.tintColor
        editor.autoresizingMask = [.flexibleWidth, .flexibleHeight]
    }
}


And for macOS:

class ViewController: NSViewController {
    @IBOutlet var textView: NSTextView!
    let storage = Storage()

    override func viewDidLoad() {
        super.viewDidLoad()

        let theme = Theme("one-dark")
        storage.theme = theme
        textView.backgroundColor = theme.backgroundColor
        textView.insertionPointColor = theme.tintColor
        textView.layoutManager?.replaceTextStorage(storage)
    }
}

Themes

Take a look at all of the themes and swatches when choosing the theme for your Notepad, or as inspiration for a new one.

You can find all of the raw themes in the themes folder, and the file names are case-sensitive.

Custom Regex

Using 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:

"handle": {
  "regex": "[@@][a-zA-Z0-9_]{1,20}",
  "color": "#78ddd5"
}

Installation

Copy the source from the Notepad folder to your project, or add Notepad to your Podfile if you're using CocoaPods.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].