1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[KL] Markdown Parser 1.0.1

Markdown Support for XenForo

  1. katsulynx

    katsulynx Well-Known Member

    katsulynx submitted a new resource:

    [KL] Markdown Parser - Markdown Support for XenForo

    Read more about this resource...
     
  2. katsulynx

    katsulynx Well-Known Member

  3. katsulynx

    katsulynx Well-Known Member

    katsulynx updated [KL] Markdown Parser with a new update entry:

    Version 1.0

    Read the rest of this update entry...
     
  4. katsulynx

    katsulynx Well-Known Member

  5. Katelyn

    Katelyn Member

    Hiya!!

    We started testing this recently and there are some problems with special characters being escaped.
    If you use the '&' symbol, it will cause it to display '&' instead. (I believe other symbols are affected too...)
    Also, it disfigures the quote box when quoting a message as shown by our example below:

    Notice the "&" being inserted at the start of the quote box.

    Any words of advice?

    TY!
     
  6. Katelyn

    Katelyn Member

    Well, we haven't been able to get this to work properly.

    If anyone else is using with success, please let me know. :)

    It may be a good idea to make a switch for the editor to switch between BB code and Markdown.
     
  7. Bloodcinder

    Bloodcinder Well-Known Member

    I have a question. Does a post containing Markdown actually store the Markdown, which gets dynamically converted to BBCode and rendered on the fly when the post is viewed, or does it pre-convert to BBCode and store just the BBCode in the post without preserving the original Markdown?
     
  8. katsulynx

    katsulynx Well-Known Member

    Sorry, I forgot to reply after coming back from holidays. I have a quick fix around, but it certainly only makes the problem worse, so I have to put some more time into working around this.

    I modified the markdown parser to no longer parse the markdown to html directly but to convert it to BBCode first. This sounds a little bit unnecessary and complicated at first, but it ensures compatibility with other addons that play around with the original BBCodes and/or the design of those (especially e.g. the quote BBCode) and makes the addon more robust (for example users will never be able to inject any form of unwanted html into your page through a backdoor in the parser, cause XenForos BBCode-Parser will simply convert all HTML to Text.
     
  9. Bloodcinder

    Bloodcinder Well-Known Member

    Right, I'm just asking if the converted BBCode is actually saved into the post or if the Markdown is converted to BBCode right before the normal BBCode parsing stage during view only. Or, in other words, if I edit a post that used Markdown will I see the original Markdown or the generated BBCode?
     
  10. katsulynx

    katsulynx Well-Known Member

    The markdown if I remember correctly.
     
    Bloodcinder likes this.
  11. Katelyn

    Katelyn Member

    Thanks for your reply, I will keep checking for further updates. :)
     
  12. katsulynx

    katsulynx Well-Known Member

  13. katsulynx

    katsulynx Well-Known Member

    I thought about that, but I simply fail to see the advantage of that. The WYSIWYG-Editor provides all capabilities necessary for a user to mark up their text to their likings. As Markdown gets converted back to BBCode anyway, there's no advantage of offering that kind of WYSIWYG. The second thing is with markdown being so intuitive and uncomplicated to write as it is (that's one of the design principles after all), there's no reason to offer some form of buttons for it, be it WYSIWYG or not, cause it'd simply take you longer to press that button than to just hit the appropriate keyboard combination. That said, the amount of work that'd need to be put into such a functionality would be tremendously oversized in my opinion for a rather small usage scenario - if even.
     
    Bloodcinder likes this.
  14. Bloodcinder

    Bloodcinder Well-Known Member

    I see that in the overview it says that you support any Markdown which can be converted to equivalent BBCode. For the purposes of clarity, could you list the supported Markdown syntax? If you don't have time, I understand.
     
  15. katsulynx

    katsulynx Well-Known Member

    Code:
    *Italic* -> [i]Italic[/i]
    _Italic_ -> [i]italic[/i]
    
    **Bold** -> [b]Bold[/b]
    __Bold__ -> [b]Bold[/b]
    
    ***Bold Italic*** -> [b][i]Bold Italic[/i][/b]
    *__Bold Italic__* -> [b][i]Bold Italic[/i][/b]
    **_Bold Italic_** -> [b][i]Bold Italic[/i][/b]
    ___Bold Italic___ -> [b][i]Bold Italic[/i][/b]
    
    * List 1 -> [list][*] List 1
    * List 2 -> [*]List 2
    - List 3 -> [*] List 3
    - List 4 -> [*]List 4[/list]
    
    1. List -> [list=1][*]List[/list]
    
    # Text -> [size=7]Text[/size]
    ## Text -> [size=6]Text[/size]
    ### Text -> [size=5]Text[/size]
    #### Text -> [size=4]Text[/size]
    ##### Text -> [size=3]Text[/size]
    ###### Text -> [size=2]Text[/size]
    ####### Text -> [size=1]Text[/size]
    
    > Quote -> [quote]Quote[/quote]
    
    `Some Code` -> [code]Some Code
     
  16. Bloodcinder

    Bloodcinder Well-Known Member

    Excellent. Thank you. I think I'm going to install this during my next batch of upgrades.
     
    katsulynx likes this.
  17. Bloodcinder

    Bloodcinder Well-Known Member

    I'm going to pester you one more time... Could you put that list that you just posted up above on the Overview page of the add-on? I think it would get you more installs, and it would act as a convenient reference if you don't have to go looking for it in a thread. Just a suggestion!
     
    katsulynx likes this.
  18. Bloodcinder

    Bloodcinder Well-Known Member

    When the plugin is enabled, line breaks for paragraphs are duplicated, even without any Markdown in use. So, a post whose source looks like this:
    Code:
    Line 1.
    
    Line 2.
    And is supposed to look like this:
    Instead looks like this:
     
  19. drsprite

    drsprite New Member

    Hi is it possible to have the ` ` backticks not do [ code]?

    I'm looking for inline syntax highlighting without breaking it into a [ code] box. Like wrap in a <span> or something instead, which I can CSS style.

    I suppose I could edit the addon to achieve this.

    Thanks
     
  20. katsulynx

    katsulynx Well-Known Member

    The Markdown is always rendered to BBCode first, so in case you want to alter the [code]-Tag completely, there won't be any issue. If you want to change the tag it is rendered to, try changing the following lines in library\KL\MarkdownParser\BbCode\Parsedown.php: 46, 271, 362, 938, 1034, 1489. I haven't experimented with that before though.
     
    drsprite likes this.

Share This Page