Code Monkey home page Code Monkey logo

Comments (8)

Kloenk avatar Kloenk commented on June 21, 2024

This library seems like it could do the job quite well: https://github.com/JohnSundell/Ink

from nio.

helje5 avatar helje5 commented on June 21, 2024

Or this one, probably makes more sense than an arbitrary custom parser: https://github.com/apple/swift-cmark

from nio.

Kloenk avatar Kloenk commented on June 21, 2024

Also AttributedString, but it does not seem to have anything to output html, only to render markdown

from nio.

helje5 avatar helje5 commented on June 21, 2024

The HTML generated by NSAttributedString isn't any good anyways, IIRC. I use CMark in SwiftPM Catalog to display the READMEs, and it works really well for that purpose (and is very easy to use).

from nio.

helje5 avatar helje5 commented on June 21, 2024

Finally, for editing, the message composition field should probably be a rich text field as well, so that users can also just bold/italic the text. So the HTML renderer is (should be) not just "Markdown to HTML", but "Markdown + AttributedString attributes to HTML".

from nio.

Kloenk avatar Kloenk commented on June 21, 2024

The HTML generated by NSAttributedString isn't any good anyways, IIRC. I use CMark in SwiftPM Catalog to display the READMEs, and it works really well for that purpose (and is very easy to use).

Do you have api doc for cmark-swift (or a link to a project which uses it)?
I did not yet figure out if we can add the mx-* custom html tags. This is as far as I saw possible in Ink.

The AttributedString is new in iOS 15 IIRC.

from nio.

helje5 avatar helje5 commented on June 21, 2024

AttributedString is new in iOS 15. NSAttributedString was new in NeXTstep.

Presumably those "mx" tags would be produced by typing @user and #channel and such? Not sure whether such things can be added to CMark.
In Nio however, one should deal with those in the UI anyways. I.e. if you type @, a completion panel should pop up and then store the result as an attributed string key (and turn the text into a proper "pill"/badge).

I say "should", because this is quite a bit of work to get right :-)

from nio.

Kloenk avatar Kloenk commented on June 21, 2024

It's also there for Blockquote > . This is AFAIK defined in the markdown spec, but resulting html is changed for matrix.

Stuff like @user #channel is IIRC just an a tag, with a link (usually matrix.to)

from nio.

Related Issues (20)

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.