• 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.2

No permission to download

katsulynx

Well-known member
#3
katsulynx updated [KL] Markdown Parser with a new update entry:

Version 1.0

PATCH NOTES
  • This addon is now out of beta.
  • The underlying structure has been changed, so markdown is now first mapped to BBCode, before BBCode is actually rendered. This offers the following improvements:
    • Markdown and BBCode can now be fully mixed in absolutely every possible combination
    • More markdown commands are now available, including Quotes and Code-Blocks
    • Headlines are now mapped to XenForos [size]-tag, eliminating potential styling...
Read the rest of this update entry...
 
#5
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:

katsulynx submitted a new resource:

[KL] Markdown Parser - Markdown Support for XenForo
Notice the "&" being inserted at the start of the quote box.

Any words of advice?

TY!
 
#6
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.
 

Bloodcinder

Well-known member
#7
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?
 

katsulynx

Well-known member
#8
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.
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 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?
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.
 

Bloodcinder

Well-known member
#9
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?
 

katsulynx

Well-known member
#10
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?
The markdown if I remember correctly.
 

katsulynx

Well-known member
#13
It may be a good idea to make a switch for the editor to switch between BB code and Markdown.
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

Well-known member
#14
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.
 

katsulynx

Well-known member
#15
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
 

Bloodcinder

Well-known member
#17
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!
 
#19
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
 

katsulynx

Well-known member
#20
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.