Skip to content

Instantly share code, notes, and snippets.

@NotNite
Last active May 25, 2025 15:36
Show Gist options
  • Save NotNite/6d8914050437851de09c4dd7e20ec5b7 to your computer and use it in GitHub Desktop.
Save NotNite/6d8914050437851de09c4dd7e20ec5b7 to your computer and use it in GitHub Desktop.
/*
monospace.css obsidian snippet (by @notnite) - normalizes source mode to be actually monospace
*/
/* use monospace font in source view */
.markdown-source-view {
--font-text: var(--font-monospace);
}
/* headers */
.markdown-source-view {
/* size all headers equally */
--h1-size: var(--font-text-size);
--h2-size: var(--font-text-size);
--h3-size: var(--font-text-size);
--h4-size: var(--font-text-size);
--h5-size: var(--font-text-size);
--h6-size: var(--font-text-size);
--h1-weight: var(--font-normal);
--h2-weight: var(--font-normal);
--h3-weight: var(--font-normal);
--h4-weight: var(--font-normal);
--h5-weight: var(--font-normal);
--h6-weight: var(--font-normal);
--h1-line-height: var(--line-height-normal);
--h2-line-height: var(--line-height-normal);
--h3-line-height: var(--line-height-normal);
--h4-line-height: var(--line-height-normal);
--h5-line-height: var(--line-height-normal);
--h6-line-height: var(--line-height-normal);
/* hide inline title */
& .inline-title {
display: none;
}
/* make the hashes bigger (fighting CSS specificity) */
& .cm-content .HyperMD-header .cm-formatting-header {
font-size: inherit !important;
}
}
/* lists */
.markdown-source-view {
/* indent lists to 2 characters */
--list-indent: 1em;
/* hide lines on list indents */
& .cm-indent::before {
display: none !important;
}
}
/* codeblocks */
.markdown-source-view {
/* remove padding */
& .cm-line.HyperMD-codeblock {
padding: 0 !important;
}
}
/* footnotes */
.markdown-source-view {
/* make footnotes bigger */
--footnote-size: var(--font-text-size);
& .cm-footref, .cm-hmd-footnote {
font-size: inherit !important;
/* fix positioning */
top: 0 !important;
vertical-align: inherit !important;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment