Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft-to-markdown needs to escape special characters #52

Closed
ckoppelman opened this issue May 11, 2018 · 10 comments
Closed

Draft-to-markdown needs to escape special characters #52

ckoppelman opened this issue May 11, 2018 · 10 comments
Labels

Comments

@ckoppelman
Copy link

ckoppelman commented May 11, 2018

If I enter _abc_ into the draft editor, I'd expect to see the Markdown editor have \_abc\_.

There are a set of similar test cases:

  1. * sdfsfsf => \* sdfsfsf
  2. abc **sdasda** => abc \*\*sdasda\*\*
  3. 4. abc => 4\. abc
  4. c `abc` d => c \`abc\` d
  5. > sdfjsflsdkfj => \> sdfjsflsdkfj
  6. \abc => \\abc
@Rosey Rosey added the bug label May 11, 2018
@Rosey
Copy link
Owner

Rosey commented May 11, 2018

Thank you for pointing this out! Will prioritize a fix.

I've never noticed this because I use a markdown plugin on my draft editor that auto-converts to italics etc when you use those characters, so it never has come up for me 😄

@nicholaswbowen
Copy link

nicholaswbowen commented May 11, 2018 via email

@ckoppelman
Copy link
Author

ckoppelman commented May 11, 2018

By the way, I just learned the proper way to escape backticks in inline code spans -- it's not backslashes.

Apparently you just need to use different numbers of backticks at the start and end of your code. So if you have a single backtick literal inside your code span, you need to start/end with at least two backticks. If you have two backtick literals together inside a code span, you need to use one or three or more backticks to start/end your code span. If you have single, double and triple backtick literals inside your code span, you need to use at least four backticks to start/end your code span.

Gah!

@Rosey
Copy link
Owner

Rosey commented May 11, 2018

Lol yay

@Rosey
Copy link
Owner

Rosey commented May 11, 2018

Ok I have a branch going but I don't think it's comprehensive enough yet to open a pr

@Rosey
Copy link
Owner

Rosey commented May 11, 2018

ahh, opened a pr. I can't even describe to you how messed up I am these days, last night I only got 4 hours of sleep, so... yep. I guess if I were a good nerd I'd just wait to fix bugs until I can actually do it properly but lmk how you feel about this fix. I'll merge it if @ckoppelman and @nicholaswbowen are ok with it as an interim solution?

@nicholaswbowen
Copy link

This is a good interim solution. I hope to make some contributions some time soon, maybe I'll take a crack at this. For my use case, people posting links into the editor is very common. That PR will let me delete code atleast :) . Thanks!

@Rosey
Copy link
Owner

Rosey commented May 16, 2018

For my use case, people posting links into the editor is very common.

Just out of curiosity - if people are posting [link](http://google.com) ...why on earth are they pasting such specific markdown code and NOT wanting it converted? Like I can see how benign characters like * and _ that could have other meanings shouldn't be converted, but links are so very markdowny

@Rosey
Copy link
Owner

Rosey commented May 16, 2018

Made a new issue for some of the outstanding work that needs to be done :) #55 Thank you to both of you!

@Rosey Rosey closed this as completed May 16, 2018
@nicholaswbowen
Copy link

Oh, I think I misunderstood what you meant. I don't imagine many people would use the link syntax in the draft editor.

What my problem is that I am serializing everything as Markdown, and comments get rendered in remarkable. So if URLs have any of the escaped characters in them, it breaks the link when it gets rendered. What I am suggesting is a regex expression that detects something as simple as https://google.com and doesn't escape any of the characters in that string. Then remarkable will just linkify them and I have happy customers.

I hope that makes sense. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants