Fenced code blocks are parsed as inline code if backticks are not preceded by two newlines.
Example input:
const input = "Run the following commands and verify no results are returned:\n```\n# group\ngrep ^shadow:[^:]*:[^:]*:[^:]+ /etc/group\n# passwd\nawk -F: '($4 == \"<shadow-gid>\") { print }' /etc/passwd\n```"
Run the following commands and verify no results are returned:
group
grep ^shadow:[^:]:[^:]:[^:]+ /etc/group
passwd
awk -F: '($4 == "") { print }' /etc/passwd
Rendered output:
To get the expected output, an additional newline is needed before the triple backticks:
const input = "Run the following commands and verify no results are returned:\n\n```\n# group\ngrep ^shadow:[^:]*:[^:]*:[^:]+ /etc/group\n# passwd\nawk -F: '($4 == \"<shadow-gid>\") { print }' /etc/passwd\n```"
Run the following commands and verify no results are returned:
group
grep ^shadow:[^:]:[^:]:[^:]+ /etc/group
passwd
awk -F: '($4 == "") { print }' /etc/passwd
Rendered output:
This behavior is unexpected since Github's markdown compiler seems to only require one newline before the triple backticks. Though they do recommend blank lines before and after code blocks for readability purposes.
Fenced code blocks are parsed as inline code if backticks are not preceded by two newlines.
Example input:
group
grep ^shadow:[^:]:[^:]:[^:]+ /etc/group
passwd
awk -F: '($4 == "") { print }' /etc/passwd
Rendered output:
To get the expected output, an additional newline is needed before the triple backticks:
group
grep ^shadow:[^:]:[^:]:[^:]+ /etc/group
passwd
awk -F: '($4 == "") { print }' /etc/passwd
Rendered output:
This behavior is unexpected since Github's markdown compiler seems to only require one newline before the triple backticks. Though they do recommend blank lines before and after code blocks for readability purposes.