Bilberry v4 Sandbox

Raw HTML enabled!

Test Hugo Built-in Syntax Highlighting

2023-04-05 2 min read Syntax Highlighting Igor

Test article post with blocks of Go and Java code highlighted via Hugo’s built-in Chroma (monokai).

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed dapibus justo quis dui dictum, pretium tincidunt elit lacinia. Proin ultricies massa ex, et laoreet tortor condimentum id.

linenos=false

package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")
}

linenos=inline

1package main
2
3import "fmt"
4
5func main() {
6    fmt.Println("Hello, World!")
7}

linenos=true

1
2
3
4
5
6
7
package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")
}

linenos=table

1
2
3
4
5
6
7
package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")
}

linenos=inline, hl_lines=“7-12 21-26”

 1class CalculatorTest {
 2  Calculator calculator = new Calculator();
 3  Integer op1;
 4  Integer op2;
 5  Integer result;
 6
 7  @BeforeEach
 8  void setUp() {
 9    op1 = null;
10    op2 = null;
11    result = null;
12  }
13
14  @Nested
15  class Multiply {
16    @BeforeEach
17    void setUp() {
18      // executes before each test within this nested class
19    }
20
21    @Test
22    void twoPositiveOperands_correctPositiveResult() {
23      given_twoOperands(6, 3);
24      when_multiply();
25      then_assertResult(18);
26    }
27
28    private void when_multiply() {
29      result = calculator.multiply(op1, op2);
30    }
31  }
32
33  @Nested
34  class Divide {
35    @Test
36    void secondOperandZero_arithmeticException() {
37      given_twoOperands(6, 0);
38      when_divide_then_assertExceptionThrown(ArithmeticException.class);
39    }
40
41    @Test
42    void twoPositiveOperands_correctPositiveResult() {
43      given_twoOperands(6, 3);
44      when_divide();
45      then_assertResult(2);
46    }
47
48    private void when_divide() {
49      result = calculator.divide(op1, op2);
50    }
51
52    private void when_divide_then_assertExceptionThrown(Class<? extends Exception> exception) {
53      assertThrows(exception, () -> calculator.divide(op1, op2));
54    }
55  }
56
57  private void given_twoOperands(int op1, int op2) {
58    this.op1 = op1;
59    this.op2 = op2;
60  }
61
62  private void then_assertResult(int expected) {
63    assertThat(result).isEqualTo(expected);
64  }
65}

Pellentesque non est id nulla viverra accumsan. Sed ullamcorper placerat vestibulum. Aliquam erat volutpat. Duis id leo diam. Aliquam ultrices magna eget vulputate congue. Donec lacus turpis, consectetur at convallis in, malesuada ut ligula.