Skip to content

Instantly share code, notes, and snippets.

@havenchyk
Created February 15, 2022 13:42
Show Gist options
  • Save havenchyk/559beeb456b2fe9078bd4294634e4f3b to your computer and use it in GitHub Desktop.
Save havenchyk/559beeb456b2fe9078bd4294634e4f3b to your computer and use it in GitHub Desktop.
GitHub markdown table with code formatting
filename example of code
client/.happo.js require('dotenv').config();
client/globalSetup.ts
require('dotenv').config({
  path: path.resolve(process.cwd(), 'client', '.env'),
});
@mr-mig
Copy link

mr-mig commented Feb 15, 2022

If you want a coumn-like layout, you MUST use HTML tables for that.

There's a trick of rendering Markdown within HTML though.
The rule is like that: if you want to render markdown within a <table>-based layout, you need to include newlines before and after the MD block:

<td>

**This line** will be rendered as  _markdown_

</td>

Copy link

ghost commented Feb 15, 2022

@mr-mig

Markdown table & videos are tears:

| ios | android |
|---|---|
| https://user-images.githubusercontent.com/95620376/154093638-056f3bef-f56a-4f0d-a0e3-89f2fad52244.mp4 | https://user-images.githubusercontent.com/95620376/154093638-056f3bef-f56a-4f0d-a0e3-89f2fad52244.mp4 |
ios android
https://user-images.githubusercontent.com/95620376/154093638-056f3bef-f56a-4f0d-a0e3-89f2fad52244.mp4 https://user-images.githubusercontent.com/95620376/154093638-056f3bef-f56a-4f0d-a0e3-89f2fad52244.mp4

HTML variant

<table>
<tr>
<td>

ios

</td>
<td>

android

</td>
</tr>
<tr>
<td>

https://user-images.githubusercontent.com/95620376/154093638-056f3bef-f56a-4f0d-a0e3-89f2fad52244.mp4

</td>
<td>

https://user-images.githubusercontent.com/95620376/154093638-056f3bef-f56a-4f0d-a0e3-89f2fad52244.mp4

</td>
</tr>
</table>

ios

android

151585253-8b33b097-4bf6-460a-85ab-078816128071.mp4
151585253-8b33b097-4bf6-460a-85ab-078816128071.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment