| 1 | --- |
| 2 | name: max-height |
| 3 | description: Set a fixed height for code blocks with scrolling for long code |
| 4 | --- |
| 5 | |
| 6 | # Code Block Max Height |
| 7 | |
| 8 | Set a fixed height for code blocks with scrolling. |
| 9 | |
| 10 | ## Usage |
| 11 | |
| 12 | ````md |
| 13 | ```ts {2|3|7|12}{maxHeight:'100px'} |
| 14 | function add( |
| 15 | a: Ref<number> | number, |
| 16 | b: Ref<number> | number |
| 17 | ) { |
| 18 | return computed(() => unref(a) + unref(b)) |
| 19 | } |
| 20 | /// ...as many lines as you want |
| 21 | const c = add(1, 2) |
| 22 | ``` |
| 23 | ```` |
| 24 | |
| 25 | ## With Line Highlighting Placeholder |
| 26 | |
| 27 | Use `{*}` when you only need maxHeight: |
| 28 | |
| 29 | ````md |
| 30 | ```ts {*}{maxHeight:'100px'} |
| 31 | // long code here |
| 32 | ``` |
| 33 | ```` |
| 34 | |
| 35 | ## Use Case |
| 36 | |
| 37 | When code is too long to fit on one slide but you want to show it all with scrolling. |
| 38 |