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

Error: Could not parse code block #244

Open
ElSargo opened this issue May 14, 2023 · 3 comments
Open

Error: Could not parse code block #244

ElSargo opened this issue May 14, 2023 · 3 comments

Comments

@ElSargo
Copy link

ElSargo commented May 14, 2023

Getting error Error: could not parse code block when trying to execute the following valid rust

fn main() {
  const N: usize = 10;
  let mut is_prime = [true;N];
  for p in 2..N {
    if is_prime[p] {
      let mut mul = 2;
      while let Some(num) = is_prime.get_mut(p * mul){
        *num = false;
        mul += 1;
      }
    }
  }

  println!("{:?}", is_prime.iter().enumerate().skip(2).filter_map(|(i,b)| b.then(|| i)).collect::<Vec<_>>());
}

To Reproduce

  • Add the code block to a slide
  • Present and try to execute it with ctrl-e
  • Should error

Expected behavior

[ 2, 3, 5, 7]

should be printed as the output of the block

Desktop (please complete the following information):

  • OS: NixOS
  • Browser: librewolf
  • Version: 0.9.0

Additional context

  • using rustc 1.64.0
  • slides form nixpkgs repo
@fpiwowarczyk
Copy link

I had similar issue when my code had codeblock with space before name of language like below

``` go 

instead of

```go

maybe it is your issue too, but hard to tell because you didn't provided actual markdown file here.

@maaslalani
Copy link
Owner

Hey, are you able to try slides from the latest source code? I am using it on main installed through go and everything seems to be working correctly for me.

image

@maaslalani
Copy link
Owner

Could you also try the example in the rust example in the examples/code_blocks.md (https://raw.githubusercontent.com/maaslalani/slides/main/examples/code_blocks.md) to see if that works for you?

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

3 participants