MARKDOWN Class for Xojo™ - now available

  1. ‹ Older
  2. 2 months ago

    Dave S

    Jan 18 San Diego, California USA

    @Wayne G BTW 3^2 is 9 not 8 which is 2^3 :)

    LOL! That was a test, and you passed :)

  3. Eduardo G

    Jan 18 Pre-Release Testers Europe (Madrid, Spain)

    @Dave S Sorry.... I tried doing that once.. but it was way too much effort to get it working, figuring out how Linux worked etc... But that is why I compiled it for Linux, to allow anyone who is a Linux Fan to try it. There is nothing OS dependent, so I really don't see there being an issue. The class is 100% Xojo code, and uses standard agnostic coding practices.

    I have thought for a while that Xojo could help development for Linux when developing in other platforms by providing a single-click VM that can be easily used to just run the apps without bothering with the set-up.

    I imagine providing such an image in a couple of popular formats (Parallels, VMWare, VirtualBox, QEmu, etc.) would be appreciated for Mac or Windows developers (and wouldn't be a problem like releasing one with Windows or MacOS). Bonus points if it already has Xojo remote debugger in it and running :)

  4. 5 weeks ago

    Garry P

    Feb 18 Pre-Release Testers, Xojo Pro Europe (Torquay, UK)

    There's a bug in your demo app Dave. For some reason it is inserting an unordered list into a code fence. Here's an example:

    Javascript code:
    
    ```javascript
    /*
     * This comment will be incorrectly converted to a HTML list!
     */
    console.log("Bug!");
    ```

    Outputs:

    <p>Javascript code:</p>
    <pre class='codeblock'><code class='language-javascript'>
    /*
    <ul style='padding-top:10px'>
    <li>This comment will be converted to an HTML list!
    </ul>
    </ul>
    */
    console.log("Bug!");
    <code></pre>

    Expected output:

    <p>Javascript code:</p>
    <pre class='codeblock'><code class='language-javascript'>
    /*
     * This comment will be converted to an HTML list!
     */
    console.log("Bug!");
    </code></pre>

    As you can see, there are several issues with your class' output:

    1. For some reason it's generating an unordered list within a <pre> block. This shouldn't happen.
    2. In the (incorrect) <ul> block it's not closing the <li> tag
    3. The <code> tag is not correctly closed at the end.

    Also, why is the class injecting inline CSS to the <ul>? This isn't part of the specs and should be left up to the end user to style with a CSS stylesheet.

  5. Dave S

    Feb 18 San Diego, California USA
    Edited 5 weeks ago

    Thanks for pointing this out.
    I have already corrected these items..... it turns out it was an unforeseen side effect of changes last month

    I will post an updated demo later today

    your markdown example [with a list added]

    Javascript code:
    ```javascript
    /*
     * This comment will be incorrectly converted to a HTML list!
     */
    console.log("Bug!");
    ```
    * test
    * test 2

    now results in this

    <p>Javascript code:</p>
    <pre class='codeblock'><code class='language-javascript'>
    /*
     * This comment will be converted to an HTML list!
     */
    console.log("Bug!");
    </code></pre>
    <ul class=list_top_pad>
    <li>test
    <li>test 2
    </ul>

    note : list_top_pad is part of CSS now

  6. Jeff T

    Feb 18 Midlands of England, Europe

    it's not closing the <li> tag

    Interesting. I've never personally seen a closed <LI> tag

  7. Dave S

    Feb 18 San Diego, California USA

    Updated version of the demo is now available

    macOS
    Windows
    Linux

  8. 4 weeks ago

    Garry P

    Feb 18 Pre-Release Testers, Xojo Pro Europe (Torquay, UK)

    Thanks for the quick patch. I still think there's an issue though. It strips the newline characters from within a code block.

    This:

    ```javascript
    console(1);
    
    console(2);
    ```

    Outputs:

    <pre class='codeblock'><code class='language-javascript'>
    console(1);
    console(2);
    </code></pre>

    But I believe it should be:

    <pre class='codeblock'><code class='language-javascript'>
    console(1);
    
    console(2);
    </code></pre>

    By stripping out the newlines, it hampers the ability to demonstrate well formatted code snippets.

    @Jeff T Interesting. I've never personally seen a closed <LI> tag

    It's optional except for XHTML compliance. In other words - there's no good reason to leave it out: StackOverflow .

  9. Dave S

    Feb 18 San Diego, California USA

    ok..... that is now fixed.... and with a new option to the syntax. The ability to add line numbers. This is not part of the "Standard", but has been implemented in various ways by many other engines.

    ```javascript linenum
    console(1);
    
    console(2);
    ```

    And Garry.... I'm gonna give you a few more hours to find something else :) then I'll post this update

  10. scott b

    Feb 18 Pre-Release Testers, Xojo Pro local coffee shop

    @Dave S And Garry.... I'm gonna give you a few more hours to find something else :) then I'll post this update

    be careful for what you wish for. :)

  11. Dave S

    Feb 18 San Diego, California USA

    @scott b be careful for what you wish for. :)

    Rather he found something now, then an hour after I recompile it all :)

  12. scott b

    Feb 18 Pre-Release Testers, Xojo Pro local coffee shop

    @Dave S Rather he found something now, then an hour after I recompile it all :)

    I was trying to make a bad scarcastic remark. it failed.

  13. Garry P

    Feb 18 Pre-Release Testers, Xojo Pro Europe (Torquay, UK)

    I couldn't resist digging...

    Haven't found anything else yet though :)

  14. Emile S

    Feb 19 Europe (France, Strasbourg)

    @Garry P In the (incorrect) <ul> block it's not closing the <li> tag

    https://www.w3schools.com/html/html_lists.asp

    And I already saw (many times) the </LI> tag…

  15. Garry P

    Feb 19 Pre-Release Testers, Xojo Pro Europe (Torquay, UK)

    I hate to do this Dave but there's another bug:

    This input:

    ### <a name="tith"></a>This is the Heading

    Produces this output:

    <h3>&lt;a name="tith">&lt;/a>This is the Heading</h3>

    It should be:

    <h3><a name="tith"></a>This is the Heading</h3>

    Currently, there is no way with your parser to include an inline anchor in a header.

    Reference parser:

  16. Dave S

    Feb 19 San Diego, California USA

    Garry..... rather find bugs and fix them, them let them proliferate :)
    Actually it kinda does handle that kind of situation..... just not correctly it seems :(

    First it does find certain HTML tags and keep them intact.... but here <A> wasn't one of them... for example use <DIV> in your example and the results are totally different. still wrong, but the HTML stayed intact.

    What it tries to do is insert a code fence for HTML. The problem is this inserts an extra line feed which screws up the ### in your example. but works for "most" situations

    The problem is determining what inside <> is HTML and what is just "stuff" that should be made "safe"

    Let me work on this.... I have some ideas :)

  17. Dave S

    Feb 19 San Diego, California USA

    Ok..... I think I got it!
    Any text entity the starts with a "<" followed by a legit HTML tag and ends with ">" will be considered to be HTML and will be injected AS-IS. Any "<" or ">" not meeting these criteria will be converted to &lt; and &gt;. You can force this by escaping using \< or \>

    What a legit HTML tag is comes from https://developer.mozilla.org/en-US/docs/Web/HTML/Element

  18. scott b

    Feb 19 Pre-Release Testers, Xojo Pro local coffee shop

    thanks @Garry P and @Dave S for find/fixing the bugs in this code so quickly. I know in the past I found an issue and let Dave know about it, stating that I was going to look at the source code later. Before I could get to the computer to look at the source code, he had it patched. the turn around on “hey I found an issue” to “hey its patched” is amazingly fast. thank you both!

  19. Dave S

    Feb 19 San Diego, California USA

    Appreciate the comments..... OCD I guess :)

    I'm going to update the example Markdown document, clean up some stuff... "test" it a bit more then give Garry a chance to break it again

  20. Garry P

    Feb 19 Pre-Release Testers, Xojo Pro Europe (Torquay, UK)

    I can't decide if I like this developing reputation I have for breaking things. I guess everyone needs a super power :)

    Thanks for the great work Dave.

  21. Dave S

    Feb 19 San Diego, California USA

    @Garry P I can't decide if I like this developing reputation I have for breaking things. I guess everyone needs a super power :)

    Thanks for the great work Dave.

    When you can't break it, then everyone will benefit :)

or Sign Up to reply!