Markdown multiline code blocks in tables when rows have to be specified with one-liners
26,726
Solution 1
Replace `
with <code>
tags and use
and <br>
for indentation.
Similarly you can use <pre>
tags instead of ```
.
Solution 2
Answer by @Meredith is the perfect answer to this. I'd like to add more details and examples below
You cannot replace `
with <code>
if you need to add other HTML tags inside the <code>
element in your table cell. Instead you need to use backtick (`
) inside the <pre>
tag like this:
Markdown Input | HTML Output | HTML Preview |
---|---|---|
|
<pre><p>Test line</p></pre> |
|
Example 2:
Markdown Input | HTML Output | HTML Preview |
---|---|---|
`{a: 1, b: 2, c: 3}` |
<code>{a: 1, b: 2, c: 3}</code> |
{a: 1, b: 2, c: 3} |
|
<pre> {JSON: <br>  ["Key1":"Value1",<br>  "Key2":"Value2"]<br> } </pre> |
{JSON: |
Author by
Meredith
Updated on October 21, 2021Comments
-
Meredith over 2 years
I have a table:
| YAY! | TABLE | \^^/ | 1-liner JSON column! | | ---- | ----- | ---- | -------------------- | | That | has | JSON | `{a: 1, b: 2, c: 3}` | | Here | is | more | `{d: 4, e: 5, f: 6}` |
Is there any way for me to insert in multiline code blocks into a generated table cell?