Code Monkey home page Code Monkey logo

notepad's Issues

Start a changelog

Start a CHANGELONG.md file to detail each change that is pushed to CocoaPods.

New release version

It may be a good time to create a new release as a lot has changed and improved since 0.3.0.

Features and bugs.

image

code block is not support. like use

public ...

regex with error.
more element type support. h4, h5, h6, line, steps.
how about show the image.
how about support html element.

Suggestion for an app-configurable special kind of theme

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?

Internal Protection Level

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.

attribute run ranges are in inconsistent state

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

Line break inside bold or italic markup leaves first part marked up

  1. Run the example Mac app.
  2. Place the caret in the middle of the word bold.
  3. Hit return.
  4. Observe that the first part of the word (bo) is still bold while the part on the new line (ld) is regular weight. It seems that both parts should either be bold or not be bold.

Same type of error for italics.

Custom attributes

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

Change Markdown syntax colours

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)

Change text programmatically

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?

Use System Font

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) ?

Align text in the centre

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.

Placeholder support

Thanks for the great project. Do we have plan to support the placeholder? Thanks!

Suggestion box is too big

I have a problem when my TextView starts with a #Title
screen shot 2017-11-22 at 9 14 27

As you can see the cursor and the suggestion box is too big, I guess it uses the title's size value. Is there any way to fix it?

use NSTextContainer from Notepad initializer

Notepad.init(frame: CGRect, textContainer: NSTextContainer?) does not actually use textContainer. This at least violates obvious expectations :) (And the Liskov Substitution Principle)

Cannot call value of non-function type module<Notepad>

I wanted to give Notepad a try so I added the Pod to my project and I could also import it like so:

import Notepad

import

The problem

As soon as I try to instantiate a Notepad object I get the following error:

screen shot 2017-01-24 at 15 28 41

I am using the Xcode 8.2.1

Not compatible with Xcode 8.3.2 Or Swift 3.0

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.

Unable to load your theme file.

Hello !

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

fix bold + italic: consider adding traits to a base font instead of requiring font names

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.

  • If the current style scope has a font setting, it adds the traits to the font name -- thus making a setting like "font": "Menlo-Bold", traits: [ "bold" ] redundant.
  • If the current style's scope has no font name set, the style will use the base (body) font and add the traits.
  • If no style ever did set a custom font, it falls back to the current system font.

What do you think?

swift 4?

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?

Code regular expression

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 = "(`.*`)"

Unable to be used with CocoaPods

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.

Issue with Xcode 10.2

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

make a Type for built-in themes

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.

macOS pod installation

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.

Hide markdown syntax as cursor leaves the position?

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")

First Character of a new line is always uppercase

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.