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

Cleanup code block tags #131

Closed
alexkazik opened this issue Nov 25, 2022 · 3 comments
Closed

Cleanup code block tags #131

alexkazik opened this issue Nov 25, 2022 · 3 comments

Comments

@alexkazik
Copy link

Since the code blocks in the readme often do not compile anyway due to removing the comments, the extra tags are probably not helpful and can be removed/replaced.

Suggestion: when a code block is identified as rust (is_rust_code_block) then remove all tags and replace it with "rust".

Should probably optional or possible to switch off. Also someone may want to have another tag (including the empty string).

@orium
Copy link
Owner

orium commented Nov 25, 2022

It already does that. It strips tags that only have meaning for rustdoc. For instance if you have

//! ```should_panic
//! fail!("foo");
//! ```

cargo-rdme generates this README:

```rust
fail!("foo");
```

This stuff is tested here:

fn test_markdown_tag_for_known_code_block_tags() {

If this is not what you mean, please give a concrete example.

@alexkazik
Copy link
Author

Yes it does. I'm very sorry. For whatever reason I used "rust,no_compile" (and not ignore, I have no idea where I picked that up).

Interestingly enough the rust doc does what I want: do rust syntax highlight and not show a "untested" badge next to it (as ignore does).

@orium
Copy link
Owner

orium commented Nov 25, 2022

It seems no_compile is not currently a thing in rustdoc, but it seems it might become one: rust-lang/rust#96573

When it does I'll update cargo-rdme to support that.

@orium orium closed this as completed Nov 25, 2022
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