[Module] MarkDown Gadget (all OS)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

[Module] MarkDown Gadget (all OS)

Post by Thorsten1867 »

MarkDown Gadget & Requester - Module (all OS / 64Bit / DPI)

Display or convert text in MarkDown syntax
  • Markdown - Gadget to display text in markdown syntax
  • Export the gadget content to HTML or PDF
  • Convert text in MarkDown to HTML or PDF
  • Message-Requester with support of the Markdown-Syntax
  • Help Windowto display help files based on Markdown syntax
Image _____ Image

The module supports:
  • Basic Syntax (Headings / Emphasis / Lists / Links / Images /...)
  • Tables
  • Task Lists/ Definition Lists
  • Emphasis/ Strikethroughs / Underlining
  • Keystrokes
  • Abbreviations (with explanation)
  • Footnotes
  • Superscript & Subscript
  • Emojis
  • Notes
  • Table of Contents/ Glossar
  • Keywords (for help window)

Code: Select all

; MarkDown::UsedImages()         - determines all images used in the markdown text
; MarkDown::InsertAsPDF()        - Insert converted markdown text into PDF
; MarkDown::InsertAsHTML()       - Insert converted markdown text into HTML
; MarkDown::SetPath()            - set path for images without path name

; ----- Gadget (#Enable_Gadget)-----

; MarkDown::AttachPopupMenu()
; MarkDown::Clear()              - similar to 'ClearGadgetItems()'
; MarkDown::Convert()            - convert markdown to HTML or PDF (without gadget)
; MarkDown::EventValue()         - returns links
; MarkDown::Export()             - export to HTML or PDF 
; MarkDown::Gadget()             - new MarkDown gadget
; MarkDown::GetData()            - similar to 'GetGadgetData()'
; MarkDown::GetText()            - similar to 'GetGadgetText()' [#MarkDown/#HTML]
; MarkDown::GetID()              - similar to 'GetGadgetData()', but string
; MarkDown::GotoHeading()        - goto heading with this ID
; MarkDown::Hide()               - similar to 'HideGadget()'
; MarkDown::SetAutoResizeFlags() - [#MoveX|#MoveY|#Width|#Height]
; MarkDown::SetAttribute()       - similar to 'SetGadgetAttribute()'
; MarkDown::SetColor()           - similar to 'SetGadgetColor()'
; MarkDown::SetData()            - similar to 'SetGadgetData()'
; MarkDown::SetFont()            - similar to 'SetGadgetFont()'
; MarkDown::SetID()              - similar to 'SetGadgetData()', but string
; MarkDown::SetMargins()         - defines the margins
; MarkDown::SetPath()            - Set the path to the Markdown file, for relative path names
; MarkDown::SetText()            - similar to 'SetGadgetText()'
; MarkDown::UseImage()           - uses an already loaded image

; ----- Requester (#Enable_Requester) -----

; MarkDown::Requester()

; ----- Help Window (#Enable_HelpWindow) -----

; MarkDown::Help()
; MarkDown::ChangeHelpTopic()
; MarkDown::EventLabel()
Download: MarkDownModule.pbi
Last edited by Thorsten1867 on Mon Apr 13, 2020 11:25 am, edited 6 times in total.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: [Module] MarkDown Gadget (all OS)

Post by Kwai chang caine »

Works nice here :D
2004 and never heard talking about this language :shock:
Yesterday "*..ofx" a format for bank account, today "*.md" this light format....
Nearly all the day i can learn a "new" format od numerous years old :oops:
Thanks for sharing and to have taught me the existence of this old extension 8)
ImageThe happiness is a road...
Not a destination
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] MarkDown Gadget (all OS)

Post by Thorsten1867 »

In reasonable note apps (such as Joplin) MarkDown is standard.
But only now I realized what MarkDown can do (extended syntax).

Gesendet von meinem Aquaris X2 mit Tapatalk
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] MarkDown Gadget (all OS)

Post by Thorsten1867 »

Update:
  • Added: SuperScript & SubScript
  • Added: Emojis
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
blueb
Addict
Addict
Posts: 1041
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Re: [Module] MarkDown Gadget (all OS)

Post by blueb »

Happy New Years Thorsten :D

Found a small error.. Program does not return properly after pressing the 'HTML' (Button) button...

Code: Select all

            Case #Button4
             CompilerIf Defined(PDF, #PB_Module) ; added
               MarkDown::Export(#MarkDown, MarkDown::#HTML, "Export.htm", "PDF")
               RunProgram("Export.htm")
             CompilerEndIf ; added
          EndSelect
Best wishes for the new decade.
- It was too lonely at the top.

System : PB 6.10 Beta 9 (x64) and Win Pro 11 (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] MarkDown Gadget (all OS)

Post by Thorsten1867 »

That doesn't really make sense. HTML does not need the PDF module.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
blueb
Addict
Addict
Posts: 1041
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Re: [Module] MarkDown Gadget (all OS)

Post by blueb »

Thorsten1867 wrote:That doesn't really make sense. HTML does not need the PDF module.
Ahhh...
I see what's going on now...

The example program does not re-gain focus after pressing one of the buttons, the program runs and hides behind the PureBasic IDE (which is still running)

If I only minimize the PDF or the WEB page (Chrome in my case), I cannot view the running EXE.

But...If I kill Chrome or the PDF program, everything displays correctly.


The confusing part... there is no icon on my taskbar that shows the running program, so I assumed the program did not exit properly.
- It was too lonely at the top.

System : PB 6.10 Beta 9 (x64) and Win Pro 11 (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
User avatar
HeX0R
Addict
Addict
Posts: 980
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: [Module] MarkDown Gadget (all OS)

Post by HeX0R »

You need to get rid of the #PB_Window_Tool flag, then you will see it again in the task bar.
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] MarkDown Gadget (all OS)

Post by Thorsten1867 »

Update:
  • Added: Definition List
  • Added: Code Blocks / Fenced Code Blocks
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] MarkDown Gadget (all OS)

Post by Thorsten1867 »

After I found a specification for MarkDown, I completely rewrote the parser to achieve the greatest possible compatibility.
  • Added: Reference link
  • Added: Highlight
  • Added: new emojis ( :bookMark: / :date: / :mail: / :memo: / :pencil: / :phone: )
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] MarkDown Gadget (all OS)

Post by Thorsten1867 »

To realize all features, I had to change the internal structure of the parser completely.
  • Inline emphasis for lists, tables, footnotes, ...
  • Abbreviations "*[HTML]: Hypertext Markup Language"
  • Keystrokes "[[Ctrl]] [[C]]"
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] MarkDown Gadget (all OS)

Post by Thorsten1867 »

Update:
  • Emphasis (bold/italic) for links, autolinks, strikethrough and highlight
  • PDF task list with images for checkboxes
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] MarkDown Gadget (all OS)

Post by Thorsten1867 »

Markdown - Editor

As a supplement to the module and as an application example a Markdown - Editor.
(Most formatting is available as a pop-up menu.)

Image
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] MarkDown Gadget (all OS)

Post by Thorsten1867 »

Update: Bugfixes & Improvements for tables
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
Fred
Administrator
Administrator
Posts: 16618
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [Module] MarkDown Gadget (all OS)

Post by Fred »

This is a very nice module !
Post Reply