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

In GitBook 3.2.0 inserts escape characters #2

Closed
stefwrite opened this issue Jul 14, 2016 · 3 comments
Closed

In GitBook 3.2.0 inserts escape characters #2

stefwrite opened this issue Jul 14, 2016 · 3 comments

Comments

@stefwrite
Copy link

stefwrite commented Jul 14, 2016

To take advantage of other features, I recently updated to use GitBook 3.2.0. I was using this plugin successfully in 2.6.6, but with 3.2.0 it tries to escape some or all of the "#" symbols. I can't seem to track down what in the newer code is doing this or how to disable it.

Code in my markdown file:
{%fbq%}Testing. Please type $$hello## (hello) and $$world## (world).{%endfbq%}

How it renders in my browser, just above the "Submit" button:
Testing. Please type ______________ (hello) and $$world\#\# \(world\).

The Submit button and results text appear to work fine, but they automatically go to a "Correct" state without my having entered anything.

I can try to track down what is escaping the "#" characters and see if I can prevent that from happening, but I suspect there is more that needs to be resolved here.

@stefwrite
Copy link
Author

stefwrite commented Jul 15, 2016

Update based on my experimenting today: I was able to get the questions to render blanks instead of escaped "#" characters if I changed the index.js in the plugin to use "@@" instead of "##", though it still wanted to escape the parentheses around the last word in the sentence:

The lines I changed in the index.js file; note the "@@" replacing the "##" in each line:
29> ans.push(substr[i].split("@@", 1));
30> var str = '$$' + ans[i - 1].toString() + '@@';

In the markdown file:
{%fbq%}Testing. Please type $$hello@@ (hello) and $$world@@ (world).{%endfbq%}

In the browser display:
Testing. Please type ____________ (hello) and _____________ \(world\).

The behavior of the blanks and the incorrect/correct states started working again by using this workaround. Since this involves a fundamental change in the instructions for plugin use, though, I hesitate to submit it as a patch. I will let the owners decide how they want to address the issue more permanently.

@isaacyiu0369
Copy link
Collaborator

Thanks for the detailed and helpful comments. Give me some time to look into it, will report back asap.

@isaacyiu0369
Copy link
Collaborator

It turns out that gitbook 3.0+ will auto escape characters like #, I fixed it by running the content through a markdown parser first before replacing the code. The changes has been published as version 1.0.0.

Thanks for reporting. Please report back if you found any other issues.

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

No branches or pull requests

2 participants