maaslalani / slides

Terminal based presentation tool
http://maaslalani.com/slides/
MIT License
9.65k stars 264 forks source link

Error: Could not parse code block #244

Open ElSargo opened 1 year ago

ElSargo commented 1 year ago

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

Expected behavior

[ 2, 3, 5, 7]

should be printed as the output of the block

Desktop (please complete the following information):

Additional context

fpiwowarczyk commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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?