markdown-to-jsx
markdown-to-jsx copied to clipboard
Text following line-starting HTML tag gets split into new pargaraph
Been digging through the code and can't quite figure out the why of this behavior and how to change it. per https://probablyup.com/markdown-to-jsx/
<ins>Insertion before text</ins> followed by some text
Some text <ins>insertion within</ins> text
becomes rendered as
<ins>Insertion before text</ins>
<p> followed by some text</p>
<p>Some text <ins>insertion within</ins> text</p>
when I would instead expect:
<p><ins>Insertion before text</ins> followed by some text</p>
<p>Some text <ins>insertion within</ins> text</p>
Any hint in the right direction? Thanks in advance.
By default we expect html to be block level, so if it's the first thing on the line, it's left by itself and not wrapped in a paragraph. This could possibly be made smarter... I'll look into it.
Any news ?
Edit:
In my case I'm using white-space: pre-line;
A temporary solution could be setting forceInline
to true
while replacing newline with
like
compiler(text.replace(/\n/g,"<br/>"), {
forceInline: true
}
Do not use it on public page ! It could break your SEO ! However it's great for a simple chat (for instance) because it's not rated by search engine and it does not need list and separator. Then it's not adapted for a forum. I'm still looking for a solution.
Nope I’ve been extremely busy at work. I’ll probably have some free time soon if someone else doesn’t fix it before then. On Fri, Mar 15, 2019 at 7:55 PM Bastien ADAM [email protected] wrote:
Any news ?
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/probablyup/markdown-to-jsx/issues/220#issuecomment-473483261, or mute the thread https://github.com/notifications/unsubscribe-auth/AAiy1i1rQDOI2gCmyj6M98nkf9fMWu-Yks5vXEEKgaJpZM4Xvw3W .
~~I have done some modifications, it works perfectly for my usage https://github.com/Buom01/markdown-to-jsx/commit/435f3ba7f11d12b7b14d3245044c049e065e1271~~ (Repo removed/recreated as I will probably refactor it properly, but the commit is still usable while it make tests fails, use at your risk)
It was almost about priority
That breaks a lot of tests unfortunately :/
Any progress on this? We are facing the same issue.
I’ve been very sick for the past month and am currently in the hospital so you won’t hear from me for a bit
On Fri, May 17, 2019 at 6:07 AM cubian [email protected] wrote:
Any progress on this? We are facing the same issue.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/probablyup/markdown-to-jsx/issues/220?email_source=notifications&email_token=AAELFVS7QB5Q7JE4F4IWSBLPV2GXRA5CNFSM4F57BXLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVUO3CY#issuecomment-493415819, or mute the thread https://github.com/notifications/unsubscribe-auth/AAELFVRAVSQ3Y5LVFS33MZ3PV2GXRANCNFSM4F57BXLA .
I’ve been very sick for the past month and am currently in the hospital so you won’t hear from me for a bit
@probablyup good recovery and health to you
Any progress on this? We are facing the same issue.
Because I had time, I have updated my fork properly to make it working and make tests to pass. Notes:
- It will only works with a predefined list of html elements
I will make a pull request from https://github.com/buom01/markdown-to-jsx/ to https://github.com/probablyup/markdown-to-jsx/
This is still an issue after more than a year. Any updates, please?
https://opencollective.com/markdown-to-jsx
Are you saying contributions will change the attitude and will somehow make more time available to the author? How much is needed?
@meglio Absolutely, I have limited personal time and don't intend to spend my time on this project for anything other than vital security updates unless I can adequately compensate myself.
You're welcome to submit a PR if you want to spend your own time on it, or make a donation. As far as amount, I think at least $100 is fair; think about what you would charge for an hour or two of your own time.
Thanks for explaining @probablyup. Does your response also indicate that the project is not actively maintained anymore and we should not expect any significant updates / improvements / feature development?
If so, it is not an issue - I completely understand the motivation behind it; but could you mention that in the readme file as to set the correct expectations for those choosing a markdown library when starting a new project? That would be fair to state upfront. For instance, if I had read about the current state of the project (don't intend to spend my time on this project for anything other than vital security updates), I would have not chosen this library, and now it is extra time to migrate to another library that is actively maintained. So not saying that upfront penalizes library users with no reason. What do you think?
Not at all, just that it will happen when I get the inspiration to do it if I'm not being compensated. You're welcome to choose whatever library you like; this one has a unique set of goals related to library size and extensibility that you might have a hard time replicating.
As always, you're welcome to contribute a fix yourself if you don't want to donate.
I think fixed in 7.1.6