Skip to content

no_run and other playpen parameters not added to <code> classes if space separated #397

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

Closed
budziq opened this issue Aug 7, 2017 · 3 comments · Fixed by #403
Closed

no_run and other playpen parameters not added to <code> classes if space separated #397

budziq opened this issue Aug 7, 2017 · 3 comments · Fixed by #403

Comments

@budziq
Copy link
Contributor

budziq commented Aug 7, 2017

The additional playpen parameters (in case of inline markdown rust code) are not added to class list of generated playpen if separated by whitespace from the rust language specifier.

```rust, no_run
...

this should result in

<code class="language-rust no_run">...</code>

edit:
following works

```rust,no_run
...

while the space separated does not

```rust, no_run
...

edit2: This feature works somewhat outside of CommonMark spec. rust,no_run is treated as language-rust,no_run by the virtue of not containing any whitespace. CommonMark spec does not specify any mandatory behavior for the reminder of the codeblock header (which pulldown-cmark eagerly utilizes dropping everything after the whitespace)

TLNR: I learnt something new today ;)

@budziq budziq changed the title no_run and other playpen parameters no longer added to <code> classes no_run and other playpen parameters not added to <code> classes if space separated Aug 8, 2017
@budziq
Copy link
Contributor Author

budziq commented Aug 8, 2017

The no_run,ignore,should_panic annotation is already eagerly used by several mdbooks and markdown test preprocessors. The best I can think of to make the behavior more consistent is to preprocess the markdown codeblock headers in order to get rid of whitespace. Pushing non spec conformant changes to pulldown-cmark is not realistic nor desirable.

@azerupi
Copy link
Contributor

azerupi commented Aug 8, 2017

make the behavior more consistent is to preprocess the markdown codeblock headers in order to get rid of whitespace.

Sounds good to me, preprocess to remove withespace, feed to pulldown-cmark, post-process to replace commas by spaces.

@budziq
Copy link
Contributor Author

budziq commented Aug 8, 2017

Right. Possibly another converter could be added to utills::render_markdown along the lines of EventQuoteConverter

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

Successfully merging a pull request may close this issue.

2 participants