How can I apply Codly settings specifically to one block?

Hey there,

I wasted a lot of time today trying to customize just one specific codly code block and not all of the other ones.

The situation I got is, that I want to make a codly block, which doesn’t have any line numbers, as this is not necessary and takes away some space on the left.

Since #codly does not take any body argument, I do not know how I can achieve this.

I don’t want to enable the numbering manually for every single code block, as this would be nerve-wracking every single time (which is quite often for my thesis).

Has anyone else had similar issues before and found a solution?

I would be very grateful for a solution to this :smile:

Thanks in advance
John

Codly provides #local which takes the same arguments as #codly but applies them only to the local code block.

#local(number-format: none)[
  ```rust
  pub fn main() {
      println!("Hello, world!");
  }
  ```
]

An alternative would be to disable the line numbering before your code block and re-enabling it after.

Thank you very much! This is exactly what I have been looking for :smile:

So setting it locally works for disabling numbers, but I can’t pass the highlights parameter to the local function. Is there also a solution?

Interesting, no idea why. It does work by calling codly inside local, like this:

#local(number-format: none)[
  #codly(highlights: (
     (line: 2, start: 5, end: 12, fill: red),
  ))
  ```rust
  pub fn main() {
      println!("Hello, world!");
  }
  ```
]

Thanks that’s it, then I will use this workaround and in the meantime I will open an Issue in the repo. Thanks a lot :100: