U++ framework
Do not panic. Ask here before giving up.

Home » Developing U++ » U++ Developers corner » [Proposal] Markdown to QTF converter/parser
[Proposal] Markdown to QTF converter/parser [message #53137] Fri, 06 March 2020 21:22 Go to next message
Oblivion is currently offline  Oblivion
Messages: 1266
Registered: August 2007
Senior Contributor
Hello,

I've been thinking about this for a while.

Markdown format has gained a lot of traction in the last few years.

I think U++ and TheIDE can benefit from this (for example, TheIDE or any U++ app using QTF can display markdown formatted text it its intended form, using a MD -> QTF conversion).

To this end, I propose encapsulating the MD4C ("Markdown for C") library.

It does not take much space, comes as a single header and source file, is multiplaform (Win, POSIX), easy to encapsulate, and very fast.

It has MIT license.

Here is the MD4C's github link: https://github.com/mity/md4c

What do you think?

(I can get it ready for U++ 2020.2 release)

Best regards,
Oblivion


[Updated on: Fri, 06 March 2020 21:36]

Report message to a moderator

Re: [Proposal] Markdown to QTF converter/parser [message #53145 is a reply to message #53137] Mon, 09 March 2020 04:17 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 703
Registered: December 2005
Location: Budapest, Hungary
Contributor
I would be happy with that.

[Updated on: Mon, 09 March 2020 04:17]

Report message to a moderator

Re: [Proposal] Markdown to QTF converter/parser [message #53146 is a reply to message #53137] Mon, 09 March 2020 08:43 Go to previous messageGo to next message
Xemuth is currently offline  Xemuth
Messages: 387
Registered: August 2018
Location: France
Senior Member
That's a good idea Smile Thanks
Re: [Proposal] Markdown to QTF converter/parser [message #53150 is a reply to message #53146] Mon, 09 March 2020 11:32 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1239
Registered: March 2006
Location: Italy
Senior Contributor
Very good!

Luigi
Re: [Proposal] Markdown to QTF converter/parser [message #53155 is a reply to message #53137] Mon, 09 March 2020 16:07 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14291
Registered: November 2005
Ultimate Member
Good, that will be a nice little plugin/

Mirek
Re: [Proposal] Markdown to QTF converter/parser [message #54392 is a reply to message #53155] Sat, 11 July 2020 17:09 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1266
Registered: August 2007
Senior Contributor
Ok,

I have started implementing the parser. Hopefully the first official version of it will be available around September if not earlier.

Best regards,
Oblivion


[Updated on: Sat, 11 July 2020 17:09]

Report message to a moderator

icon14.gif  Re: [Proposal] Markdown to QTF converter/parser [message #54393 is a reply to message #54392] Sat, 11 July 2020 23:10 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 740
Registered: November 2008
Location: France
Contributor
Thumbs Up
Nice addition to Upp
Re: [Proposal] Markdown to QTF converter/parser [message #54401 is a reply to message #54393] Sun, 12 July 2020 13:36 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3459
Registered: August 2008
Senior Veteran
That would be great, as we could have the same help files visible in GitHub and U++ web portals, and in U++ apps. Smile

Best regards
Iñaki
Re: [Proposal] Markdown to QTF converter/parser [message #54408 is a reply to message #54401] Tue, 14 July 2020 10:40 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14291
Registered: November 2005
Ultimate Member
koldo wrote on Sun, 12 July 2020 13:36
That would be great, as we could have the same help files visible in GitHub and U++ web portals, and in U++ apps. Smile


Yeah, well, but we would need QTF->MD for that I guess instead Smile Which is doable too, but harder.

Mirek
Re: [Proposal] Markdown to QTF converter/parser [message #54416 is a reply to message #54408] Tue, 14 July 2020 20:30 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3459
Registered: August 2008
Senior Veteran
mirek wrote on Tue, 14 July 2020 10:40
koldo wrote on Sun, 12 July 2020 13:36
That would be great, as we could have the same help files visible in GitHub and U++ web portals, and in U++ apps. Smile


Yeah, well, but we would need QTF->MD for that I guess instead Smile Which is doable too, but harder.

Mirek
At least, the MD->QTF is good for the new helps.


Best regards
Iñaki
Re: [Proposal] Markdown to QTF converter/parser [message #54738 is a reply to message #53137] Sat, 05 September 2020 00:12 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1266
Registered: August 2007
Senior Contributor
Hi,

A small update and news:

The MD -> QTF converter plugin/wrapper is progressing nicelty.
All the basic stuff (headers, character styles, URL and image links) is done. The more complex stuff (lists & tables) have proven to be somewhat more difficult to convert to qtf. (they can contain more elements than what qtf allows), but there is progress on that side too. So, at least a primitive form of table and list support will hopefully land in first release. Not to mention that I am working on qtf styles supports for md blocks and spans.

A screenshot of the early wersion of -possible- reference example (MarkdownEditor):

index.php?t=getfile&id=6184&private=0

Best regards,
Oblivion


Re: [Proposal] Markdown to QTF converter/parser [message #54747 is a reply to message #54738] Sat, 05 September 2020 20:19 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 740
Registered: November 2008
Location: France
Contributor
Starting to look good !
Re: [Proposal] Markdown to QTF converter/parser [message #54901 is a reply to message #53137] Sun, 27 September 2020 22:47 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1266
Registered: August 2007
Senior Contributor
Hi,

Another small update/nws.

Markdown to qtf converter is progressing nicely.
After some wrestling with "loose" lists, I have managet to map complex DOM model to qtf.

A screenshot:

index.php?t=getfile&id=6229&private=0


Unfortunately the package won't be available in the upcoming upp 2020.2 release. But I'll probably send the initial version in couple of weeks.

Best regards,

Oblivion


[Updated on: Sun, 27 September 2020 22:49]

Report message to a moderator

Re: [Proposal] Markdown to QTF converter/parser [message #54902 is a reply to message #54901] Sun, 27 September 2020 23:52 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 703
Registered: December 2005
Location: Budapest, Hungary
Contributor
Seems to be very cool! Thanks for working on it!
Re: [Proposal] Markdown to QTF converter/parser [message #55827 is a reply to message #54902] Fri, 18 December 2020 10:54 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14291
Registered: November 2005
Ultimate Member
What is the status? I feel like this would be useful with UppHub.... (we could display github readme in theide)

Even partially working solution would be fine for now.

Mirek
Re: [Proposal] Markdown to QTF converter/parser [message #55828 is a reply to message #55827] Fri, 18 December 2020 10:59 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1266
Registered: August 2007
Senior Contributor
Quote:
What is the status? I feel like this would be useful with UppHub.... (we could display github readme in theide)

Even partially working solution would be fine for now.


Mostyly done, except image loading mechanism, styling api and some cleanup. If it's OK, I'll upload it with the editor/converter example on next monday or tuesday (21-22), after I cleanup the code this weekend.
Then I'll start working on completing the missing parts.


Best regards,
Oblivion


[Updated on: Fri, 18 December 2020 11:02]

Report message to a moderator

Re: [Proposal] Markdown to QTF converter/parser [message #55829 is a reply to message #55828] Fri, 18 December 2020 11:11 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14291
Registered: November 2005
Ultimate Member
OK, thank you.
Re: [Proposal] Markdown to QTF converter/parser [message #55862 is a reply to message #55829] Wed, 23 December 2020 20:40 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1266
Registered: August 2007
Senior Contributor
Hello Mirek,

FYI, I have delayed the initial release several more days.
The reason is I couldn't find time to finalize it earlier and I don't want to publish a sphagetti-code just because "it works".
I'm in the process of streamlining it, and I'll release it, this weekend.

I am really sorry for the delay. And thank you for your patience.

Best regards,
Oblivion


[Updated on: Wed, 23 December 2020 20:41]

Report message to a moderator

Re: [Proposal] Markdown to QTF converter/parser [message #55863 is a reply to message #55862] Wed, 23 December 2020 22:06 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 703
Registered: December 2005
Location: Budapest, Hungary
Contributor
Good news!
It would be useful for me also. I'm almost at the point starting to code my own parser.
BTW, your OAuth code is extremely useful in one of my a projects also. I added some extra to it. Are you open to get my paches to that?
Re: [Proposal] Markdown to QTF converter/parser [message #55864 is a reply to message #55863] Wed, 23 December 2020 22:34 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1266
Registered: August 2007
Senior Contributor
Hello zsolt,

Quote:

I'm almost at the point starting to code my own parser.


Don't bother, It is almost ready. You don't want to dive into that hell. Very Happy

Quote:

BTW, your OAuth code is extremely useful in one of my a projects also. I added some extra to it. Are you open to get my paches to that?


Sure, I'd be more than happy to enhance the OAuth code and receive contributions (which you will be credited for)!

Best regards,
Oblivion


[Updated on: Wed, 23 December 2020 22:36]

Report message to a moderator

Re: [Proposal] Markdown to QTF converter/parser [message #55884 is a reply to message #55864] Sat, 26 December 2020 01:22 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 703
Registered: December 2005
Location: Budapest, Hungary
Contributor
OK, I palan registering to github to be able to send you pull requests. Or is it enough for you if I save my commits to files and send them to you in PM here?
The changes are made to be able to use it with Google in a desktop app, signing in to send emails.
Re: [Proposal] Markdown to QTF converter/parser [message #55885 is a reply to message #55884] Sat, 26 December 2020 09:32 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1266
Registered: August 2007
Senior Contributor
Hello Zsolt,

Quote:
OK, I palan registering to github to be able to send you pull requests. Or is it enough for you if I save my commits to files and send them to you in PM here?
The changes are made to be able to use it with Google in a desktop app, signing in to send emails.


You don't need to sign in to GitHub for that, you can simply upload the modified package via a message to Bazaar OAuth topic: https://www.ultimatepp.org/forums/index.php?t=msg&th=104 12&start=0&
(Let's continue there Smile )

Best regards,
Oblivion



Re: [Proposal] Markdown to QTF converter/parser [message #55891 is a reply to message #55829] Sun, 27 December 2020 20:34 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1266
Registered: August 2007
Senior Contributor
Hello Mirek,

Please find attached the "technical preview version" of Markdown package. (Let's call it that until we fix the remaining issues (before 2021.1 release))
Package contains:

- Markdown package
- Markdown Editor Example


Markdown package contains the latest version of md4c library.
It lacks documentation, for the time being. I will add it in the following days. However, it is so simple to use, documentation is hardly required.

Current issues and todo:

## TODO:

- Image handling is yet to be implemented.
- Task lists are yet to be implemented.

## Remaining issues:

- Block elements don't have configurable style.
- Page properties (margins, indentation, etc.) are not configurable.
- Soft break is not handled very well



The Markdown editor example is a so-called "real-time" editor in which you can design/test/load/save/export markdown documents in real-time. (it reacts to key-strokes)

It is what I use to test markdown package.

If you can grant me SVN write permissions to package location after adopting the package, I'll fix the remaining issues and maintain the package.

Best regards and a happy, productive new year!

Oblivion





Re: [Proposal] Markdown to QTF converter/parser [message #55912 is a reply to message #53137] Fri, 01 January 2021 14:39 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1266
Registered: August 2007
Senior Contributor
A screenshot demonstrating the image handling progress update (This is not avaiable yet):



index.php?t=getfile&id=6323&private=0



Best regards,
Oblivion


[Updated on: Fri, 01 January 2021 14:43]

Report message to a moderator

Re: [Proposal] Markdown to QTF converter/parser [message #55927 is a reply to message #53137] Mon, 04 January 2021 09:49 Go to previous messageGo to next message
jjacksonRIAB is currently offline  jjacksonRIAB
Messages: 227
Registered: June 2011
Experienced Member
Very nice. I did a simple markdown to RichCtrl a year or so ago using PEGTL, so it would be nice to see something more complete.
https://github.com/BornTactical/MarkdownFormatter

[Updated on: Mon, 04 January 2021 09:54]

Report message to a moderator

Re: [Proposal] Markdown to QTF converter/parser [message #56183 is a reply to message #53137] Thu, 04 February 2021 17:18 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14291
Registered: November 2005
Ultimate Member
It is now used in UppHub to display README.md. Unfortunately, to do that, I needed it in uppsrc (so that theide compiles from uppsrc), so moved it to plugin/md....
Re: [Proposal] Markdown to QTF converter/parser [message #56184 is a reply to message #56183] Thu, 04 February 2021 17:22 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1266
Registered: August 2007
Senior Contributor
Quote:
It is now used in UppHub to display README.md. Unfortunately, to do that, I needed it in uppsrc (so that theide compiles from uppsrc), so moved it to plugin/md....


OK, Do I have commit access? I'll commit the missing bits (styles, at least.) in this weekend.

Best regards,
Oblivion


Re: [Proposal] Markdown to QTF converter/parser [message #56186 is a reply to message #56184] Thu, 04 February 2021 20:44 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14291
Registered: November 2005
Ultimate Member
You should have commit access now.
Re: [Proposal] Markdown to QTF converter/parser [message #56187 is a reply to message #56186] Thu, 04 February 2021 21:03 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1266
Registered: August 2007
Senior Contributor
OK, thanks!

Best regards,
Oblivion


Re: [Proposal] Markdown to QTF converter/parser [message #56851 is a reply to message #53137] Wed, 21 April 2021 10:13 Go to previous message
Oblivion is currently offline  Oblivion
Messages: 1266
Registered: August 2007
Senior Contributor
Hi,

I have added image span handling to plugin/md. It should be available with U++ nightly builds.

Summary:

U++ md plugin does not render images or recognize any image format. It is up to client code to render and manipulate images. This is done via an event:

Event <VectorMap<String, String>& > WhenImages;


The md plugin will parse/collect the image data of a given md document and hand them to the client code as a string map via the WhenImages event.
The keys of this map are image URLs whereas the values are meant to be filled with some QTF/Richobject data (as qtf).

In this way, the client code can [down]load and manipulate the image data as it sees fit (e.g. it can simply substitute a qtf text on image loading/retrieval failures, or blacklist images from certain domains, or put decorative frames around images, using tables etc...)

This method also allows MT or async calls for image [down]loading and rendering, as it passes to client a complete list of available image span info at once.


Now, the map values can certainly be filled with the "whole" image strings, but this is usually not desireable, as it makes the document larger after a couple of images.
Instead you can use an array of RichObjects to keep the real image data in a cache and only pass the serial/pointer as the map value, using the QtfRichObject() function, for example.


If you have any questions, suggestions etc., let me know.


Best regards,
Oblivion







[Updated on: Wed, 21 April 2021 10:50]

Report message to a moderator

Previous Topic: How does one get argc and argv parms when making use of GUI_APP_MAIN?
Next Topic: U++ and Vulkan SDK
Goto Forum:
  


Current Time: Fri May 29 22:36:17 GMT+2 2026

Total time taken to generate the page: 0.01383 seconds