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

Bikeshed mangles script elements #2101

Open
rtoy opened this issue Jul 7, 2021 · 2 comments
Open

Bikeshed mangles script elements #2101

rtoy opened this issue Jul 7, 2021 · 2 comments
Labels

Comments

@rtoy
Copy link
Contributor

rtoy commented Jul 7, 2021

If you put something like the following into a bikeshed doc (note the backquotes for the string):

<script>
function foo(p, label, div) {
 // Do something with |p|
  let nodes = document.querySelctorAll(`*[id^="${p}"]`)
}
</script>

bikeshed prints a warning about the var |p| being used just once, And also changes the JS code to

let nodes = document.querySelectorAll(<code>*[id^="${prefix}"]</code>);

It seems as if bikeshed is parsing the contents of the script as regular bikeshed texxt. Can it be turned off?

An alternative is to place the JS code in a separate file, which works. But then the spec preview won't have the necessary files to generate the preview as expected. (The locally generated spec will, of course, look right.)

@tabatkins tabatkins added the bug label Jul 7, 2021
@tabatkins
Copy link
Collaborator

Oooof, indeed. Hm, I'm gonna have to do some mangling to get that to work. The `-Markdown behavior is done before the rest of Markdown (which knows not to look inside of scripts and similar elements) precisely because it needs to let you escape things like script open tags. I've known I'd need to get the two to work together for a while now, but with a bug report in the wild I'll really have to prioritize it.

@rtoy
Copy link
Contributor Author

rtoy commented Jul 13, 2021

Since the JS code is small, I've worked around this by not using backquotes for the strings. Works ok, but not as nice to read as with the backquotes.

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