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

Support extra code tags #9

Open
jonathanpallant opened this issue May 2, 2023 · 2 comments
Open

Support extra code tags #9

jonathanpallant opened this issue May 2, 2023 · 2 comments

Comments

@jonathanpallant
Copy link
Member

jonathanpallant commented May 2, 2023

The mdbook tool supports code blocks like:

```rust

But also ones like

```rust,editable

You typically use ,editable to get line numbers on the code block (but it also makes the code editable in-line).

The latter kind are not supported by mdslides currently - the language goes though as rust,editable which is not supported by highlight.js.

We could try and patch mdbook to make all code blocks editable by default, or we should patch mdslides to strip ,editable from any code blocks.

@jonathanpallant
Copy link
Member Author

Ah, so this works:

```rust editable
fn your_code_here() { }
```

@jonathanpallant
Copy link
Member Author

Here's a concrete example:

```rust compile_fail
use std::io::prelude::*;

fn main() -> std::io::Result<()> {
    let f = std::fs::File::create("hello.txt")?;
    write_and_close(f);
    write_and_close(f);
    Ok(())
}

fn write_and_close(mut f: std::fs::File) {
    f.write(b"hello");
}
```

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

1 participant