diff --git a/content/learning-paths/cross-platform/_example-learning-path/appendix-1-formatting.md b/content/learning-paths/cross-platform/_example-learning-path/appendix-1-formatting.md index 589c59fbe6..8a310fc356 100644 --- a/content/learning-paths/cross-platform/_example-learning-path/appendix-1-formatting.md +++ b/content/learning-paths/cross-platform/_example-learning-path/appendix-1-formatting.md @@ -83,12 +83,26 @@ Specify that line_numbers are true in the following way: \`\`\`bash { line_numbers = "true" } \ echo 'hello world' \ echo ‘I am line two’ \ -\`\`\` +\`\`\` + +```bash { line_numbers = "true" } +echo ‘hello world’ +echo ‘I am line two’ +``` + +In some cases, the line numbering should not start from one but from another +value, e.g. if the code excerpt is extracted from a larger file. Use the +`line_start` attribute to achieve this: -```bash { line_numbers = "true" } -echo ‘hello world’ -echo ‘I am line two’ -``` +\`\`\`bash { line_numbers = "true" line_start = "10" } \ +echo 'hello world' \ +echo ‘I am line two’ \ +\`\`\` + +```bash { line_numbers = "true" line_start = "10" } +echo ‘hello world’ +echo ‘I am line eleven’ +``` ### Output Lines diff --git a/themes/arm-design-system-hugo-theme/layouts/_default/_markup/render-codeblock.html b/themes/arm-design-system-hugo-theme/layouts/_default/_markup/render-codeblock.html index 7fbc711f19..196a6fcdfe 100644 --- a/themes/arm-design-system-hugo-theme/layouts/_default/_markup/render-codeblock.html +++ b/themes/arm-design-system-hugo-theme/layouts/_default/_markup/render-codeblock.html @@ -6,5 +6,5 @@ ``` */}} {{partial "general-formatting/prismjs-codeblock.html" (dict "input_from" "normal" "code" .Inner "language" .Type -"line_numbers" .Attributes.line_numbers "output_lines" .Attributes.output_lines "command_line" .Attributes.command_line) -}} \ No newline at end of file +"line_numbers" .Attributes.line_numbers "output_lines" .Attributes.output_lines "command_line" .Attributes.command_line "line_start" .Attributes.line_start) +}} diff --git a/themes/arm-design-system-hugo-theme/layouts/partials/general-formatting/prismjs-codeblock.html b/themes/arm-design-system-hugo-theme/layouts/partials/general-formatting/prismjs-codeblock.html index 407a4a6f66..565846f283 100644 --- a/themes/arm-design-system-hugo-theme/layouts/partials/general-formatting/prismjs-codeblock.html +++ b/themes/arm-design-system-hugo-theme/layouts/partials/general-formatting/prismjs-codeblock.html @@ -14,6 +14,7 @@ code Str: echo('Hello world').... language Str: python line_numbers Bool: true or false + line_start Str: 123 output_lines Str: 5 or 1-4, 9 command_line Str: "root@localhost" */}} @@ -42,14 +43,24 @@ {{$output_present = true}} {{end}} -