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

Places where API key swapping is not happening #312

Open
rmglennon opened this issue Jun 21, 2017 · 3 comments
Open

Places where API key swapping is not happening #312

rmglennon opened this issue Jun 21, 2017 · 3 comments
Assignees

Comments

@rmglennon
Copy link
Member Author

rmglennon commented Jun 21, 2017

@louh
Copy link
Contributor

louh commented Jun 23, 2017

I described my hunch in @rmglennon in Slack, here it is:

It seems that what all these code blocks have in common is that they were parsed with the Markdown parser's Codehilite module, which injects inline HTML elements around the text. This is a contrived example for illustration purposes only, but the output looks something like this:

your<span>-</span>mapzen-api-key

To the human eye, the elements are invisible and read the same as the string your-mapzen-api-key, but for a RegExp, a simple string replacement no longer matches when the string contains HTML. That's why these are getting skipped.

After looking around to see if there are good examples for making RegExps that ignore HTML, it seems that there's really no good way to do it. Instead we should rely on something else (like Mark.js, instead of writing our own code) that is capable of parsing HTML and doing word searches across HTML boundaries. Since we are likely to need to parse HTML anyway to do interactive elements (e.g. for signing in, switching keys) this seems like it is time to adjust our solution in that direction.

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