GithubHelp home page GithubHelp logo

markdowntextview's People

Contributors

thabz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

gabrail

markdowntextview's Issues

Handle numeric HTML entity escapes

Made it work in Places, but didn't need the code after switching to libxml2. Here's the functioning code, that handles both decimal and hexadecimal escapes:

    static private var HTMLNumericEntitiesRegExp: NSRegularExpression = {
        let pattern = "&#(x?)(.+?);";
        if let regexp = try? NSRegularExpression(pattern: pattern, options: NSRegularExpressionOptions()) {
            return regexp
        } else {
            fatalError("Bad regexp")
        }
    }()

and

    private func handleHTMLNumericEscapes(line: NSString) -> NSString {
        let mutable = line.mutableCopy() as! NSMutableString
        let range = NSMakeRange(0, mutable.length)
        let matches = WebPageMetaBackend.HTMLNumericEntitiesRegExp.matchesInString(mutable as String, options: NSMatchingOptions(), range: range).reverse()
        for match in matches {
            let range = match.range // Whole matched range encompasses "å"
            let isHex = !(mutable as NSString).substringWithRange(match.rangeAtIndex(1)).isEmpty
            let escape = (mutable as NSString).substringWithRange(match.rangeAtIndex(2))
            if let replacementUnicodeValue = Int(escape, radix: isHex ? 16 : 10) {
                let replacement = String(Character(UnicodeScalar(replacementUnicodeValue)))
                mutable.replaceCharactersInRange(range, withString: replacement)
            }
        }
        return mutable
    }

Ignore language part of code block

A code block on GitHub can have a little language prefix ````javascript` which we should ignore.

- (void)function:(NSString*)string

There shouldn't be a visible objc above.

Bold and italic

_ __ * ** / marks bold and italic, but are GitHub and Bitbucket is agreement on what's used for what?

Backslash escapes

Backslash escapes should function non-bold (vs. bold) and non-italic (vs. italic).

Multilevel bullet lists

GitHub supports multiple levels of bullet lists. Checked and numbered lists too.

  • Group
    • Subitem
    • Subitem
  • Group
    • Subitem
      • Subsubitem
        *Subitem

Basic image cache much needed

MarkdownTextAttachment should use a basic NSCache. See the closed issue 201 in Peopls. The comments contain some tall images, because of cell resuse the cells and images flickers when scrolling up and down.

A simple cache could fix this.

Oldschool Markdown links

Example:

Argo uses Carthage for dependency management. Running bin/setup will
install Carthage if it isn't already installed, then download the
dependencies.

Strip HTML comments

These guys

<!-- comment -->

should be stripped from non-codeblocks. Like this:

But should be visible in inline code blocks like <!-- comment -->...

Join lines with spaces

This line
And this line
Gets smashes together.

It looks like “This lineAnd this lineGets smashes together.”

Issue descriptions often gets cut off

The last one or two lines can be missing. Rotating the device between landscape and portrait fixes the problem. So the extra relayout fixes things.

This is apparently not an issue when there are images in the text, so that extra asynchronous relayout the images cause fixes things. Maybe use the same thing on all text views – embedded images or not.

This is probably an issue with comments too.

Handle links to issues

Both Bitbucket and GitHub supports links to issues by just writing #1 which is rendered as #1.

The MarkdownTextStorage constructor should take an additional parameter: repository which is independent of the Repository class in Branches. It should contains service, username and repository.

Bitbucket codeblock variation

Marks language inside code block like this:

#!swift

func inc(x: Int) -> Int {
   return x + 1
}

We should ignore the #!lang part but check the documentation first.

Handle quote blocks

Lines starting with > is part of a quote section. Indent and lighten text. Can we set an opacity on the whole paragraph, so that links also gets lighter?

Indent breaking lines in list items.

  1. Short lines are fine.
  2. Long lines that will break into multiple lines should have the subsequent lines be properly indented.
  3. I have no idea how to do this. Maybe make the whole section be indented quite a bit and the have the numbers have negative indentation values.

Trim double whitespace

We should trim all double whitespaces as would automatically happen on the normal HTML output from Markdown.

Handle checkbox style bullet lists

We should handle bullet lists like:

  • Checked with lowercase x.
  • Unchecked item.
  • Checked with uppercase X.
  • Another unchecked item, but with a pretty long text should should force a line wrap.

Images doesn't really work

If there are multiple rows with different images, they don't get shown. I think they basically don't make their containing tableviewcell resize or reload or re-something.

Rendering error

The second link in the following renders wrong. GitLab includes an issue tracker.

There's an API which looks more like GitHub than Bitbucket, so that's nice.

There's already an iOS app available, GitLab Control by Valerio Mazzeo, that's free with an in-app purchase for a pro license.

Handle links to commit SHAs

A commit SHA 3398d94 becomes a link in both GitHub and Bitbucket. Hex numbers abc112d that don't match a commit SHA doesn't become links on GitHub, which is harder to fix. They do become (dead) links to Bitbucket though.

Support non-Unicode emoji synonyms

Emoji present in Github but not in Unicode:

  • :bowtie:
  • :feelsgood:
  • :finnadie:
  • 🖕
  • :goberserk:
  • :godmode:
  • :hurtrealbad:
  • 🤘
  • :neckbeard:
  • :octocat:
  • :rage1:
  • :rage2:
  • :rage3:
  • :rage4:
  • :shipit:
  • :squirrel:
  • :suspect:
  • :trollface:

And some regional flags that might work:

  • 🇨🇳 - 1f1e8-1f1f3
  • 🇩🇪 - 1f1e9-1f1ea
  • 🇪🇸 - 1f1ea-1f1f8
  • 🇫🇷 - 1f1eb-1f1f7
  • 🇬🇧 - 1f1ec-1f1e7
  • 🇮🇹 - 1f1ee-1f1f9
  • 🇯🇵 - 1f1ef-1f1f5
  • 🇰🇷 - 1f1f0-1f1f7
  • 🇷🇺 - 1f1f7-1f1fa
  • 🇬🇧 - 1f1ec-1f1e7
  • 🇺🇸 - 1f1fa-1f1f8

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.