1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Obsidianのマークダウンエディタの書式を変更する方法

Posted at

まず vault配下の.obsidian/snippets/にcssファイルを配置する

以下は一例

style.css
/* Headingのサイズを変更する */
body {
  --h1-size: 1.50em;
  --h2-size: 1.30em;
  --h3-size: 1.20em;
  --h4-size: 1.12em;
  --h5-size: 1.12em;
  --h6-size: 1.12em;
}

/* editing modeが'Live Preview'であってもHeadingに'#'も表示させる */
div.is-live-preview div:not(.cm-active)>span.cm-header-1:not(.cm-formatting):before {
	content: "# ";
	color: gray;
}
div.is-live-preview div:not(.cm-active)>span.cm-header-2:not(.cm-formatting):before {
	content: "## ";
	color: gray;
}
div.is-live-preview div:not(.cm-active)>span.cm-header-3:not(.cm-formatting):before {
	content: "### ";
	color: gray;
}
div.is-live-preview div:not(.cm-active)>span.cm-header-4:not(.cm-formatting):before {
	content: "#### ";
	color: gray;
}
div.is-live-preview div:not(.cm-active)>span.cm-header-5:not(.cm-formatting):before {
	content: "##### ";
	color: gray;
}
div.is-live-preview div:not(.cm-active)>span.cm-header-6:not(.cm-formatting):before {
	content: "###### ";
	color: gray;
}

設定→Appearance→CSS snippetsから上記のcssファイルを有効化すると、編集時の書式が無事変更できる

before
image.png

after
Screen Shot 2023-09-16 at 21.59.47.png

ちなみにMacなら⌘ + option + iでChromeと同じようにDeveloper Toolsが開く(Electron製だかららしい.スゴい)ので、動作しなくなったらそこからHTML classとか見て調整する

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?