Created
October 28, 2020 12:10
-
-
Save parthi2929/3b1d36c530d64752b89da515a44d6652 to your computer and use it in GitHub Desktop.
Auto numbering for a Discourse Post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* inspired from: https://gist.github.com/patik/89ee6092c72a9e39950445c01598517a */ | |
| .topic-body { | |
| counter-reset: h1; | |
| } | |
| .topic-body h1 { counter-reset: h2counter; } | |
| .topic-body h2 { counter-reset: h3counter; } | |
| .topic-body h3 { counter-reset: h4counter; } | |
| .topic-body h4 { counter-reset: h5counter; } | |
| .topic-body h5 { counter-reset: h6counter; } | |
| .topic-body h6 {} | |
| .topic-body h2:before { | |
| counter-increment: h2counter; | |
| content: counter(h2counter) ".\0000a0\0000a0"; | |
| } | |
| .topic-body h3:before { | |
| counter-increment: h3counter; | |
| content: counter(h2counter) "." counter(h3counter) ".\0000a0\0000a0"; | |
| } | |
| .topic-body h4:before { | |
| counter-increment: h4counter; | |
| content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) ".\0000a0\0000a0"; | |
| } | |
| .topic-body h5:before { | |
| counter-increment: h5counter; | |
| content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) "." counter(h5counter) ".\0000a0\0000a0"; | |
| } | |
| .topic-body h6:before { | |
| counter-increment: h6counter; | |
| content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) "." counter(h5counter) "." counter(h6counter) ".\0000a0\0000a0"; | |
| } | |
| .d-editor-preview { | |
| counter-reset: h1; | |
| } | |
| .d-editor-preview h1 { counter-reset: h2counter; } | |
| .d-editor-preview h2 { counter-reset: h3counter; } | |
| .d-editor-preview h3 { counter-reset: h4counter; } | |
| .d-editor-preview h4 { counter-reset: h5counter; } | |
| .d-editor-preview h5 { counter-reset: h6counter; } | |
| .d-editor-preview h6 {} | |
| .d-editor-preview h2:before { | |
| counter-increment: h2counter; | |
| content: counter(h2counter) ".\0000a0\0000a0"; | |
| } | |
| .d-editor-preview h3:before { | |
| counter-increment: h3counter; | |
| content: counter(h2counter) "." counter(h3counter) ".\0000a0\0000a0"; | |
| } | |
| .d-editor-preview h4:before { | |
| counter-increment: h4counter; | |
| content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) ".\0000a0\0000a0"; | |
| } | |
| .d-editor-preview h5:before { | |
| counter-increment: h5counter; | |
| content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) "." counter(h5counter) ".\0000a0\0000a0"; | |
| } | |
| .d-editor-preview h6:before { | |
| counter-increment: h6counter; | |
| content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) "." counter(h5counter) "." counter(h6counter) ".\0000a0\0000a0"; | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Its inserted in theme's customization option..