|
| 1 | +--- |
| 2 | +description: Code Blocks - highlighting |
| 3 | +title: Highlighting |
| 4 | +weight: 200 |
| 5 | +--- |
| 6 | + |
| 7 | +{{<warning>}} |
| 8 | +There is an option to use the `highlight` shortcode from Hugo but we have disabled that feature as it is redundant to using ticks. All usage will throw an error in the Hugo build. |
| 9 | +{{</warning>}} |
| 10 | + |
| 11 | +## Example with highlighting one line |
| 12 | +```hcl {linenos=false,hl_lines=[16]} |
| 13 | +resource "azurerm_nginx_certificate" "cert1" { |
| 14 | + name = "examplecert" |
| 15 | + nginx_deployment_id = azurerm_nginx_deployment.test.id |
| 16 | + key_virtual_path = "/src/cert/soservermekey.key" |
| 17 | + certificate_virtual_path = "/src/cert/server.cert" |
| 18 | + key_vault_secret_id = azurerm_key_vault_certificate.test.secret_id |
| 19 | +} |
| 20 | +``` |
| 21 | + |
| 22 | +## Example with highlighting multiple consecutive lines (2-4) |
| 23 | +```hcl {linenos=true,hl_lines="2-4"} |
| 24 | +resource "azurerm_nginx_certificate" "cert1" { |
| 25 | + name = "examplecert" |
| 26 | + nginx_deployment_id = azurerm_nginx_deployment.test.id |
| 27 | + key_virtual_path = "/src/cert/soservermekey.key" |
| 28 | + certificate_virtual_path = "/src/cert/server.cert" |
| 29 | + key_vault_secret_id = azurerm_key_vault_certificate.test.secret_id |
| 30 | +} |
| 31 | +``` |
| 32 | +{{<call-out "side-callout" "Note">}} |
| 33 | +Values you can use for `hl_lines` are all non-zero positive integers. If you include a line number in `hl_lines` that does not exist (e.g. `16` in this example), it will highlight until the end. |
| 34 | +{{</call-out>}} |
| 35 | + |
| 36 | +## Example with highlighting multiple non-consecutive lines |
| 37 | +```hcl {linenos=true,hl_lines=[2,4,6]} |
| 38 | +resource "azurerm_nginx_certificate" "cert1" { |
| 39 | + name = "examplecert" |
| 40 | + nginx_deployment_id = azurerm_nginx_deployment.test.id |
| 41 | + key_virtual_path = "/src/cert/soservermekey.key" |
| 42 | + certificate_virtual_path = "/src/cert/server.cert" |
| 43 | + key_vault_secret_id = azurerm_key_vault_certificate.test.secret_id |
| 44 | +} |
| 45 | +``` |
0 commit comments