# Syntax highlighting

{% subtitle %}

Limedocs supports syntax highlighting out of the box

{% endsubtitle %}

Limedocs make use of lowlight for syntax highlighting in markdown documents.

## Specifying a block of code

Specifying a block of code in markdown can be done the following way:

  ```
    ```js
    const myJsConst = "Hello world"
    console.log(myJsConst)
    ```
  ```

And will be rendered as:

```js
const myJsConst = "Hello world"
console.log(myJsConst)
```

## Block title

You can also specify a block title. For example, this block:

  ```
    ```js title="My title"
    const myJsConst = "Hello world"
    console.log(myJsConst)
    ```
  ```

will be rendered as:

```js title="My title"
const myJsConst = "Hello world"
console.log(myJsConst)
```

## Showing lines number

To show lines number, use `show-lines="true"`. For example, this block:

  ```
    ```js title="My title" show-lines="true"
    const myJsConst = "Hello world"
    console.log(myJsConst)
    ```
  ```

will be rendered as:

```js title="My title" show-lines="true"
const myJsConst = "Hello world"
console.log(myJsConst)
```

## Highlighting specific lines

To highlight specific lines, use `highlightLines`, which takes lines number or ranges, separated by a comma.

For example, this block:

  ```
    ```js title="My title" show-lines="true" highlightLines="2-4,8"
    const myJsConst = "Hello world"
    // my comment
    console.log(myJsConst)
    console.log(1)
    console.log(2)
    console.log(3)
    // hello there
    console.log(4)
    console.log(5)
    ```
  ```

will be rendered as:

```js title="My title" show-lines="true" highlightLines="2-4,8"
const myJsConst = "Hello world"
// my comment
console.log(myJsConst)
console.log(1)
console.log(2)
console.log(3)
// hello there
console.log(4)
console.log(5)
``` 

## Multicode / tabs

You can create block tabs just by appending several blocks one after the other.
For example, this block:

  ```
    ```js title="My first tab title"
    const myJsConst = "Hello world"
    console.log(myJsConst)
    ```

    ```php title="My second example"
    echo "Hello world";
    ```
  ```

will be rendered as:

```js title="My first tab title"
const myJsConst = "Hello world"
console.log(myJsConst)
```

```php title="My second example"
echo "Hello world";
```

