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

Editor removes escape characters even if in a code block #64

Closed
durden opened this issue May 5, 2016 · 6 comments
Closed

Editor removes escape characters even if in a code block #64

durden opened this issue May 5, 2016 · 6 comments
Labels

Comments

@durden
Copy link
Contributor

durden commented May 5, 2016

I think this is an issue with the new editor and loading data for editing a guide. A guide might have text that looks like an escape character but in a code block. For example:

abs(x) = \begin{dcases*}
        x & when `x \geq 0`\\
        -x & otherwise
        \end{dcases*}

The \begin starts with \b escape character, but it's not meant to be an escape character because it's in a code block. The editor allows you to type this text and save it. However, if we come back to this guide the editor strips the \b on load.

@durden
Copy link
Contributor Author

durden commented May 5, 2016

@paulocheque Can you look into this?

Checkout this small example.

Notice how the text renders fine on the rendered markdown page (above link). Now, click the 'edit this guide' link to edit the guide. Notice how the \b is striped. This will result in changes to the original guide that the author did not intend.

I discovered this bug while testing with this real-world guide.

@durden
Copy link
Contributor Author

durden commented May 5, 2016

Here's an example of a diff where the editor removed what look like escape characters even though my real changes only changed one line, the header of the 'Introduction' line.

@durden durden added the bug label May 5, 2016
@paulocheque
Copy link
Contributor

I guess I find a good solution. I will make more tests and commit/deploy for tests.

@paulocheque
Copy link
Contributor

We were facing JS escaping problems for all JS special chars: http://www.w3schools.com/js/js_strings.asp

So now, I am using textarea to load the initial content of the article. It is much simpler and clean.

I am testing all the JS special chars and also our last issues related to escaping in these tests:
http://guides-dev.herokuapp.com/write/draft/python/testing-escape/?branch=master
http://guides-dev.herokuapp.com/write/draft/python/testing-escape-2/?branch=master

But I would like to test more on real articles, so I will make a copy of some of the production articles to check.

@durden
Copy link
Contributor Author

durden commented May 9, 2016

Looks fixed to me, thanks again!

@durden durden closed this as completed May 9, 2016
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

2 participants