## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
• Create your own community
##### Activity
Wilbert van de Ridder
@WRidder
haha, thanks! Merged your PR btw, should be up soon in the demo page once Travis is finished.
Aria Buckles
@ariabuckles
cool! thanks!
Wilbert van de Ridder
@WRidder
alright, it's up!
Aria Buckles
@ariabuckles
:)
great! I'm going to go to bed, but if you run into anything, let me know!
Wilbert van de Ridder
@WRidder
sure, thanks for the help! :)
Megh Parikh
@meghprkh
Hello, I plan to use simple markdown + katex/mathjax
But can somebody explain how to configure simple markdown only to parse Math
I saw perseus markdown.jsx but it parses other things also
like widgets etc. So can I remove those lines and it will function normally?
Also can Katex add asciimath support?
Aria Buckles
@ariabuckles
You should be able to remove most of the rules other than math in perseus-markdown.jsx to add katex/mathjax parsing to simple-markdown
(The TeX component the math rendering uses is from Khan/react-components)
I doubt KaTeX wants to implement asciimath support right now, but there's a KaTeX room for that discussion if you want (I don't do much with KaTeX). If you found an asciimath -> latex transformer, you might be able to use that with katex
( @meghprkh ^ )
Megh Parikh
@meghprkh
Thanks. But learn to know more react for I plan to use most of Khan Academy's software stack (if my site ever completes development cause I am just starting )
Shai Lachmanovich
@shaylh
Hey, there, is this room still active?
Anyway, I was wondering if it's possible that you'll
1. Add a minified version of the "simple-markdown.js" file
2. Add this amazing library to Bower package manager (bower.io)
Aria Buckles
@ariabuckles
@shaylh I don't really keep this room open much anymore, but it does go to my email ^_^.
I generally expect most people have their own js minification stack, but I can probably add a minified version.
I don't use bower but there's no dependencies, so it probably isn't hard for me to publish it there
Aria Buckles
@ariabuckles
@shaylh I put version 0.1.0 on bower and npm with a minified simple-markdown.min.js
Shai Lachmanovich
@shaylh
Wow, that's awesome! Thanks a lot :)
My temporary workaround was to install it to bower directly from github, and then minify the source myself, but it was just a hack and now it's the way it should be, so many thanks again :)
Alexey
@savelichalex
hi guys! I have a problem. I use library for react native and create custom rules, but big part of it not work. I'm console blockRegex and it show that elements like hr in inline mode. I create parser by manual with inline: false. Any ideas?
Also I see that at first that create big paragraph for all source
Alexey
@savelichalex
Ok, I change paragraph regex to this - /^([^\n]+)\n/
And now it correct parse text by paragraphs
Aria Buckles
@ariabuckles
@shaylh you're welcome!
@savelichalex it sounds like there might have been some conflicts between the regexes, but it's hard to guess without code. The other parts of the paragraph regex are for enforcing that paragraphs end in two '\n's, optionally with spaces in between. Your regex looks like it's breaking each line into a new paragraph. Does /^([^\n]+)\n\n+/ have the same effect for you? If so, that's a bit closer to the spirit of the paragraph regex. If not, I'd be very interested in seeing what regexes you're using for your custom rules.
Alexey
@savelichalex
@ariabuckles I don't use custom regexes except this for paragraph) I just make rules for react
@ariabuckles I'll try /^([^\n]+)\n\n+/ today and report result) anyway I thought about it, because with /^([^\n]+)\n/ - \n\n is paragraph too:)
@ariabuckles Also I want to ask, why you use whitespace in regexes instead \s?
Alexey
@savelichalex
Alexey
@savelichalex
oops, I found \r\n in source of my markup)
Alexey
@savelichalex
ok /^([^\r\n]+)(?:\r\n|\r|\n)+/ - work fine:)
Another thing not worked for me is hr. I remake it to this - /^(\s[-_]){3,}\s(?:\n)+\n/ (change whitespaces to \s)
Alexey
@savelichalex
Looks like need replace all \r\n|\r in text before parse it, that not write it in every rule
Alexey
@savelichalex
Give another chance to your regex for paragraph and after replace \r\n this is work fine) Maybe add check for this in library?
Aria Buckles
@ariabuckles
@savelichalex oops! there's a SimpleMarkdown.preprocess function for doing that, we should probably call that command on the input in defaultBlockParse/defaultInlineParse/defaultImplicitParse
@savelichalex I'd be happy to accept a pull request for that, or let me know and I'll add it :)
Alexey
@savelichalex
@ariabuckles why do it in this parse functions? maybe better do it right after source gotted)
I'm also thought about split parse and render part. The problem is that rules needed for parser, but when rules created there is also applied styles for blocks. It means that when I'm want to change styles, I need to create all rules again, parse text and so on
Aria Buckles
@ariabuckles
@savelichalex the defaultBlockParse/defaultInlineParse/defaultImplicitParse functions are just high level helper functions. I expect a lot of people to use parserFor to generate an actual parser, which would require preprocess to be called beforehand
parse and render aren't inherently tied together--parserFor creates a parser from the match and parse keys in the rules, whereas ruleOutput creates an output function from the react or html keys in the rules object. Those two rules objects don't need to be the same object; you could create a new object for the output and only have react or html output functions in it. I also recommend using Object.assign or _.extend to just customize the necessary rules if you want.
https://github.com/lwansbrough/react-native-markdown/blob/master/rules.js , for example, customizes just the react output functions for all the rules
That said, it is a currently a bit painful to customize just the styling of the output while leaving everything else intact, and longer-term I'd like to make that easier
Alexey
@savelichalex
@ariabuckles I mean that there is no default methods for that splitting) Actually I'm using library from ClojureScript ;)
Alexey
@savelichalex
Guys, does library work with escaping? I'm have next string "*\*Division by Zero has been addressed in the comment on Case Three.*". Actually this is em, but library not found it
Aria Buckles
@ariabuckles
@savelichalex oops, sorry I didn't see this. em/strong don't handle escaped *s correctly right now. I made issue #24 for this and can hopefully fix it, but feel free to comment there if this is still causing you issues <3
Aria Buckles
@ariabuckles
For posterity: I don't really follow this chat anymore, but please file a github issue if you're having trouble <3