# Correct way to align code block inside a list item

**URL:** <https://forum.obsidian.md/t/correct-way-to-align-code-block-inside-a-list-item/50855>\
**Category:** Help\
**Created:** [December 28, 2022, 6:06pm UTC](https://forum.obsidian.md/t/correct-way-to-align-code-block-inside-a-list-item/50855 "2022-12-28T18:06:43Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![holroy](https://forum.obsidian.md/user_avatar/forum.obsidian.md/holroy/32/77699_2.png) [@holroy](https://forum.obsidian.md/u/holroy)\
**Post date:** [December 29, 2022, 4:44pm UTC](https://forum.obsidian.md/t/correct-way-to-align-code-block-inside-a-list-item/50855/8 "2022-12-29T16:44:00Z")

</div>

The trick to getting code block to align with indentation level is to completely write it on the base level, and then insert it using f.ex. tabs to the proper indentation level. This needs to be done for the start marker, the actual code, and for the end marker.

Especially if you skip indenting the end marker of your code block, things looks wonky.

 ![image](https://forum.obsidian.md/uploads/default/original/3X/b/3/b30e0b4a796400622fb08217e23958ae03528338.png)

The example above, shows code block properly aligned from first through fourth level of indentation. Source mode to the left, reading view to the right.

---

_[View the full topic](https://forum.obsidian.md/t/correct-way-to-align-code-block-inside-a-list-item/50855)._
