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?
In summary, if you need to have a table cell span multiple lines when writing Markdown, use the HTML <br> tag, as shown.
Paragraphs. To create paragraphs in Markdown, use one or more lines of consecutive text followed by one or more blank lines. Note: If you don't leave a blank line between blocks of text, they will be collapsed into a single paragraph.
The basic Markdown syntax allows you to create code blocks by indenting lines by four spaces or one tab. If you find that inconvenient, try using fenced code blocks. Depending on your Markdown processor or editor, you'll use three backticks ( ``` ) or three tildes ( ~~~ ) on the lines before and after the code block.
A newline in Markdown is created by “2 spaces at the end of the line and a single newline”. where the _ are spaces.
Replace `
with <code>
tags and use
and <br>
for indentation.
Similarly you can use <pre>
tags instead of ```
.
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: |
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With