markdownDS - Now available in Swift!

A while back I created an Xojo class to convert MarkDown into HTML, today I ported that to Swift

It is a single class with one function

let markdown = markDOWN_to_HTML()
let s=markdown.convert(test(),asWebpage:true)

there are few flags that can be passed… if asWebpage is FALSE, then it returns only what would have been between the “” and “” tags, otherwise it creates a full webpage with CSS etc.

even though the call is Simple, there is over 2000 lines of Swift behind it.

If anyone is interested let me know


The Swift version is a bit more advanced that the Xojo version…
It will soon support Syntax Highlighting (user configurable)… right now it does Swift and Javascript

I’ve been thinking about making it a command line app… so it could be called from Xojo (but obviously for macOS only)

Any ideas?

Here is the HTML version of the Users Manual/Demo … as converted from a MD file

yeah using swift as a base language you’re quite binded to macos and ios only.
and using command line app will forbid you to go the mac appstore ?

Being bound to macOS (this can be used with iOS as well) isn’t a problem. Nor is the fact that the AppStore won’t accept CLI apps. This is mostly for my own use, or to developers who want Markdown support to add to apps they create

I checkout out the link. While I have no need for this at the moment, I am very impressed.
I guess you don’t have any need to maintain separate Xojo and Swift versions unless someone working under win doze has a need for this. I think adding command line calling is a good idea. Adding command line functionality shouldn’t stop it being used as a stand-alone app. I heard a rumour that Microsoft was interested in having swift run under its operating system, so maybe in the future you could have versions for both. In the meantime, I would expect that you will continue to develop this class to meet your own needs. Hopefully, others will make suggestions that will help you refine any future direction.

Or a person could use REMObjects tools to compile swift for WIndows :stuck_out_tongue:

Thanks… appreciate the comments.
The first major project this is scheduled to be included in is an app to document Swift Classes… Similar to Jazzy, but with a different output format, and fixing some of the anomolies that I felt Jazzy has.

And that Documentation App is being written to provide the documentation for the “BASIC” Framework that I have written to provide alot of functionality but using a syntax similar to BASIC/Xojo .

not at $599 I can’t

Is the one (description here):

yours ?

better not be mine

The one from the Xojo store is the AprendeXojo Markdown Parser. I downloaded the demo app and checked the bundle identifier to find out.

As far as Xojo parsers, I was once tasked to review MarkdownKit by our very own @Garry . I was very impressed.

1 Like

The Xojo one I wrote, was about the same time Garry wrote his… both of our did pretty much the same thing… he had a few options I didn’t, and I had some he didn’t. This latest Swift version (in my opinion) beats both those Xojo versions… but then I might be a bit biased :slight_smile:

1 Like

RemObject’s Swift compiler is 100% free for all platforms forever.

1 Like

@DaveS : your’s has (much) more markdown tag recognition than garry’s
like tables and containers.
your’s is $$ and no more sold, and garry is free.

A full Swift toolchain is available for both Windows and Linux, including the compiler, the standard library, and the core libraries (dispatch, Foundation, XCTest).

I meant if you program on swift with xcode, you also use apple framework for swift
and this one is nowhere else but ios watchos or tvos.
you can make the core programming in swift, all the user interface on three platforms is a huge work.

That is the one major aspect that is missing (or weak) on any branch of Swift except the Apple branch. The UI components are not integrated in a manner that makes true xplat possible. With this particular piece of code that would not be a problem, since it no UI, and is meant to be an addon class to an application project, not a stand-alone.

But for me, at this point, I have no interest in platforms other than iOS, macOS and tvOS

What user interface? I thought we were talking about a command line application.

I haven’t looked at DaveS’ project and don’t intend to, so it’s possible he’s using “apple framework” (whatever that is), but it doesn’t seem obvious to me that converting markdown to HTML should involve anything beyond the standard library and Foundation, which are available for Windows and Linux.

Just one question about the fractions: why is for example 2/6 automatically converted to 1/3?

If for example I write a math tutorial and tell kids that to add 1/2 + 1/3 you have to convert it to a common denominator, so 3/6 + 2/6 = 5/6 then it is VERY annoying and counterproductive to have this automatic conversion.

In general I do not think it is wise to change the user input unless it needs to be restricted.

Actually that is a very good point… if you notice in that table … .it actually reduces ALL the fractions.