mapzen / documentation

Configuration files, tools, and content to build Mapzen's documentation
https://mapzen.com/documentation
MIT License
25 stars 22 forks source link

Places where API key swapping is not happening #312

Open rmglennon opened 7 years ago

rmglennon commented 7 years ago

Cartography 1) https://dev.mapzen.com/documentation/cartography/api-reference/#sdk_mapzen_api_key

https://github.com/tangrams/cartography-docs/pull/30/files#diff-392e93c0f22d45cc0a06008607fe6e3cL25

image

2) https://dev.mapzen.com/documentation/cartography/get-started/#tangram

image

rmglennon commented 7 years ago

Android

1) https://dev.mapzen.com/documentation/android/search/#getting-started

image

2) https://dev.mapzen.com/documentation/android/search/#peliassearchview

image

3) https://dev.mapzen.com/documentation/android/turn-by-turn/#getting-started (yet works in another place in the same section)

image

rmglennon commented 7 years ago

Mobility

There are several pages where none gets replaced. However, it does update on the tutorial, so it's less likely a build issue.

1) None works on this page https://dev.mapzen.com/documentation/mobility/turn-by-turn/api-reference/#inputs-of-a-route

image

https://dev.mapzen.com/documentation/mobility/turn-by-turn/api-reference/#sample-multimodal-requests-with-transit

2) None works on this page

https://dev.mapzen.com/documentation/mobility/optimized/api-reference/#inputs-of-the-optimized-route-service

image

https://dev.mapzen.com/documentation/mobility/optimized/api-reference/#error-checking

3) None works on this page

https://dev.mapzen.com/documentation/mobility/matrix/api-reference/#inputs-of-the-matrix-service (note, I have fixed the mapzen-x reference on this page in a later commit)

image

louh commented 7 years ago

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.