Skip to content

Instantly share code, notes, and snippets.

@nstrayer
Created February 4, 2020 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nstrayer/d9f3943ed08fe8b5166b66873a2f3941 to your computer and use it in GitHub Desktop.
Save nstrayer/d9f3943ed08fe8b5166b66873a2f3941 to your computer and use it in GitHub Desktop.
CSS to make HTML build from basic markdown look like generating markdown but with the style preserved
@import url('https://fonts.googleapis.com/css?family=Inconsolata&display=swap');
body {
--text-color: #2b2a2a;
--link-color: #005fb1;
font-family: 'Inconsolata', monospace;
font-size: 15px;
color: var(--text-color);
}
h1,
h2,
h3,
h4 {
position: relative;
}
h1::before,
h2::before,
h3::before,
h4::before {
position: absolute;
right: calc(100% + 5px);
}
h1::before {
content: "# ";
}
h2::before {
content: "## ";
}
h3::before {
content: "### ";
}
h4::before {
content: "#### ";
}
em::before {
content: "_";
}
em::after {
content: "_";
}
a {
color: var(--link-color);
}
a::before {
content: "[";
}
a::after {
content: "](" attr(href) ")";
word-break: break-all;
color: var(--text-color);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment