Skip to content

Instantly share code, notes, and snippets.

@noonworks
Created July 15, 2020 05:35
Show Gist options
  • Save noonworks/6635267c116b6f4c453c7a0d8ebecdd9 to your computer and use it in GitHub Desktop.
Save noonworks/6635267c116b6f4c453c7a0d8ebecdd9 to your computer and use it in GitHub Desktop.
VSCodeのmarkdownプレビューで見出しに`1-2-2. 見出し`のように番号をつけるスタイルシート
h1 {
counter-reset: section_h2;
}
h2 {
counter-reset: section_h3;
}
h3 {
counter-reset: section_h4;
}
h4 {
counter-reset: section_h5;
}
h5 {
counter-reset: section_h6;
}
h2::before,
body.showEditorSelection h2.code-active-line::before,
body.showEditorSelection h2.code-line:hover::before {
counter-increment: section_h2;
content: counter(section_h2) ".";
margin-right: 0.25em;
display: inline;
position: static;
}
h3::before,
body.showEditorSelection h3.code-active-line::before,
body.showEditorSelection h3.code-line:hover::before {
counter-increment: section_h3;
content: counter(section_h2) "-" counter(section_h3) ".";
margin-right: 0.25em;
display: inline;
position: static;
}
h4::before,
body.showEditorSelection h4.code-active-line::before,
body.showEditorSelection h4.code-line:hover::before {
counter-increment: section_h4;
content: counter(section_h2) "-" counter(section_h3) "-" counter(section_h4) ".";
margin-right: 0.25em;
display: inline;
position: static;
}
h5::before,
body.showEditorSelection h5.code-active-line::before,
body.showEditorSelection h5.code-line:hover::before {
counter-increment: section_h5;
content: counter(section_h2) "-" counter(section_h3) "-" counter(section_h4) "-" counter(section_h5) ".";
margin-right: 0.25em;
display: inline;
position: static;
}
h6::before,
body.showEditorSelection h6.code-active-line::before,
body.showEditorSelection h6.code-line:hover::before {
counter-increment: section_h6;
content: counter(section_h2) "-" counter(section_h3) "-" counter(section_h4) "-" counter(section_h5) "-" counter(section_h6) ".";
margin-right: 0.25em;
display: inline;
position: static;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment