Skip to content

What is wrong with this string? #2186

Answered by wooorm
hahnbeelee asked this question in Q&A
Discussion options

You must be logged in to vote

First, the error in your code sandbox: you are using a \ before {. But you are embedding this text in a JavaScript string. The \ is removed by JavaScript (because \{ is the same as {). It isn’t available in the markdown/MDX. So what remark sees here is just {. So it crashes. Double encode it, so that JavaScript sees the first one, and remark sees the other one:

const sourceMarkdown = `
- Step 4: Write the policy document: "Condition": \\{ "Bool": \\{ "aws:SecureTransport": "true" } }, when the Effect element value is set to "Allow". If the Effect element is "Deny" then the condition will be "Condition": \\{ "Bool": \\{ "aws:SecureTransport": "false" } } as shown in the image below. Now on…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ChristianMurphy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants