ruddfawcett / notepad Goto Github PK
View Code? Open in Web Editor NEW[iOS] A fully themeable markdown editor with live syntax highlighting.
Home Page: http://rudd.fyi/notepad
License: MIT License
[iOS] A fully themeable markdown editor with live syntax highlighting.
Home Page: http://rudd.fyi/notepad
License: MIT License
It's a very good library and I like it because the themes are customizable. But I've tried everything to change the color of the syntax, but I didn't succeed.
Another problem I found with the links: It's only colored text, but not selectable.
Best regards.
I can't find one way using Notepad in storyboard.
Start a CHANGELONG.md file to detail each change that is pushed to CocoaPods.
It may be a good time to create a new release as a lot has changed and improved since 0.3.0
.
In macOS apps, users may want to tweak the look and feel of the application while it is running; pickers for background color, text color, font family, and text size, for example.
While it might be possible to store this as a JSON file and feed it back to the app, I think it'd be nice to have a dynamic Theme
and Style
with mutable properties which you can more directly bind to the settings pane. They would trigger layout updates on changes and expose the same public interface as static themes. (To realize this, I guess one will need a common Theme
protocol and then both StaticTheme
and DynamicTheme
or similar; name suggestions would be welcome :))
While this in theory might be useful for iOS too, I think serializing the app settings as JSON into the user defaults works just as well. You switch between view controller scenes anyway, so there's less need for live updates. Which brings up the question: should this be part of the iOS target at all?
initializer is inaccessible due to 'internal' protection level
I think the Notepad's convenience initializer needs to be made public in order to access it from outside the framework.
Example[39114:1231182] <NSATSGlyphStorage: 0x28095c4b0>: Example.Storage (0x281d50ee0) returned run range {190 19} for attributes at 192 in character range {192 57}. Since attribute run ranges are in inconsistent state, there might be layout issues such as garbled text or incorrect glyph spacings
Same type of error for italics.
Do we have any insight on how to customize the highlightning for custom attributes? say I want to add something called "user mention" like: [user][username], is this possible? if not out of the box then maybe guide me to the correct classes to implement it myself
Is there any way to use different colours for markdown symbols? Like: **, *, #, etc
?
(I know, for example the bold has a different colour from the body colour but I would like to set only the markdown syntax's alpha value or it's colour)
If I set the text property to a string after initialization, it loads, but the text is truncated. Is this the right way to set text in Notepad?
Hi there,
Before it all, thanks for sharing this project. It's pretty cool.
I was digging around the themes, and will probably create a custom one myself, though I noticed the fonts used are the ones that are listem in the system.
Is there a way to use the system font, such as UIFont.systemFont(ofSize: CGFloat, weight: UIFont.Weight)
?
Is there any way to align text centre?
I set .textAlignment
to centre, but when I type down one letter, it jumps back to left.
I try to type some emojis in the example, the syntax highlighting was broken.
Thanks for the great project. Do we have plan to support the placeholder? Thanks!
The following example should render as bold and italics at the same time:
***foobar***
Like this: foobar
However it is only rendered in bold style.
Notepad.init(frame: CGRect, textContainer: NSTextContainer?)
does not actually use textContainer
. This at least violates obvious expectations :) (And the Liskov Substitution Principle)
I was just trying to build the code but it gives me so many errors related to NSAttributedStringKey.
Error: Use of undeclared type 'NSAttributedStringKey'.
Is anyone faces this error and resolved this.
I'm new to Swift 3.0. I will appreciate your help.
Title says it all, I'll put a PR up
I have added Nodepad to my IOS project but I have this error :
[Notepad] Unable to load your theme file.
My code :
import UIKit
import Foundation
import Notepad
@IBOutlet weak 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]
}
Thank you in advance
PS : Sorry for my bad English :/
I found that to get a bold & italic font, coming up with a XYZ-BoldItalic
name doesn't work, but adding a font trait via NSFontManager
does work.
Instead of requiring font
names in the theme files, my suggestion is to add another property, maybe even call it "traits", where you can specify "bold", "italic", or both.
"font": "Menlo-Bold", traits: [ "bold" ]
redundant.What do you think?
Tried using Notepad with swift 4 and Xcode 9, but get a few errors. Some have simple fixes, others not so much. Any plans for swift 4?
I noticed looking through the example that the "code" regular expression wasn't matching statements like `let something = "hello"`
Can I suggest we change your current code expression which is:
case code = "(`\\w+(\\s\\w+)*`)"
to something that allows for any character like:
case code = "(`.*`)"
When used via CocoaPods, the Notepad.framework
is built and included, but the individual classes aren't able to be used. For example, import Notepad
works just fine, but you can't use the Notepad
class in code. Perhaps this is because there is no framework header?
This is in a Swift 3.0 project. I maintain frameworks of my own (e.g. Mapbox-iOS-SDK) so I'm fairly familiar with the process here, though I could be making a dumb mistake.
The pod try Notepad
example just has the Notepad.swift
etc. files included directly in its own module, which is why it works.
As of now, Notepad is only 21% documented (yikes). Let's get that to 100%.
I updated Xcode to version 10.2 and from that moment Notepad stopped working. I receive the error "[Notepad] Unable to load your theme file.".
Would it be possible to adjust the size of different tokens?
For example, a level 1 header # Heading
could be a larger font size than standard text.
Something like CodeMirror's implementation: http://codemirror.net/demo/variableheight.html
Add support for non CocoaPods dependency managers.
While working with the library, it took me a second to notice that Theme(_:)
doesn't load a file from my app target but only from the framework target -- so it's supposed to work with built-in themes only.
Making this clear with a named parameter, like Theme(builtInThemeName: String)
, looks awful. But I had an idea:
// A different name may be desirable
enum BuiltInTheme: String {
case oneDark: "themes/one-dark"
// ...
}
Then resolving the bundle path can be moved into that type as well.
The initializer changes to Theme(_ builtIn: BuiltInTheme)
and can be called with Theme(.oneDark)
. Upside: client apps can know which themes are built-in without looking at the source, because the enum cases are easily discoverable in Xcode.
Also, this frees up the string-based initializer to work with Bundle.main
so that client apps can call Theme("custom")
to load a resource from the app bundle.
When I try to install Notepad via CocoaPod for my macOS app, I get the following error:
The platform of the target NameApp
(macOS 10.13) is not compatible withNotepad (0.2.4)
, which does not support osx
.
Thanks.
as the title, swift 4 with cocoapods
Hi @ruddfawcett
Thanks for the awesome library.
Is this library supports Objective-C? I'm integrating using Cocoapods.
Thanks
Imad
Is it possible to have the markdown syntax hide as the cursor leaves the text? Sort of like Obsidian does in their live preview mode?
Eg writing **bold**
to only show bold? (Notice that the asterisks have been "hidden")
How can I modify the code to NOT force the first letter of a new line to be uppercase.
I cannot seem to find anything in the RegEx or code itself that is cause this
The sly gray fox
but I wish to be able to type
the sly gray fox
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.