# Hide lines from code block

**URL:** <https://zola.discourse.group/t/hide-lines-from-code-block/898>\
**Category:** Feature requests\
**Created:** [May 9, 2021, 9:44pm UTC](https://zola.discourse.group/t/hide-lines-from-code-block/898 "2021-05-09T21:44:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mockersf](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/mockersf/32/512_2.png) [@mockersf](https://zola.discourse.group/u/mockersf)\
**Post date:** [May 9, 2021, 9:44pm UTC](https://zola.discourse.group/t/hide-lines-from-code-block/898/1 "2021-05-09T21:44:36Z")

</div>

Hello!

I’m looking into how I could validate my code blocks. For that, I sometimes need to add context to the code block that I would like to not display once the site is built.

Looking at code block and fences in Zola, I think something very close to how `hl_lines` works would suit my needs: [allow code block to hide lines · mockersf/zola@4c0ed75 · GitHub](https://github.com/mockersf/zola/commit/4c0ed7516dd101e139f0a09bd6fb0a837878c257) (it’s on `master`, code blocks don’t seem to work very well on `next`).

````auto
```rust,hidden_lines=1
import my_crate::prelude::*;
hello_world();

````

Would that be something that is interesting for Zola?

Another possibility would be to do like mdBook and hide lines starting by a `#` ([mdBook-specific features - mdBook Documentation](https://rust-lang.github.io/mdBook/format/mdbook.html#hiding-code-lines)) but that could not work for some languages

---

<div class="post-metadata">

**Author:** ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)\
**Post date:** [May 10, 2021, 6:57pm UTC](https://zola.discourse.group/t/hide-lines-from-code-block/898/2 "2021-05-10T18:57:41Z")

</div>

I think it’s fine to add, maybe just call it `hide_lines`.

> Another possibility would be to do like mdBook and hide lines starting by a `#`

Definitely not, that would break many code blocks as you say.

> it’s on `master` , code blocks don’t seem to work very well on `next`

Which issues do you have?

---

<div class="post-metadata">

**Author:** ![mockersf](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/mockersf/32/512_2.png) [@mockersf](https://zola.discourse.group/u/mockersf)\
**Post date:** [May 10, 2021, 8:35pm UTC](https://zola.discourse.group/t/hide-lines-from-code-block/898/3 "2021-05-10T20:35:06Z")

</div>

> [@keats](#):
>
> Which issues do you have?

My bad, it was an issue with my theme that missed a configuration.

I opened a PR: [Hide lines in code block by mockersf · Pull Request #1453 · getzola/zola · GitHub](https://github.com/getzola/zola/pull/1453)
