Markdown-preview-enhanced: Modifying CSS to display numbered headings

Created on 11 Dec 2016  路  2Comments  路  Source: shd101wyy/markdown-preview-enhanced

Sorry for the stupid question, but how do I modify the CSS such that my headings are numbered? Eg. Level 1 heading is 1, level 2 heading is 1.1 etc.

Most helpful comment

you can try this.

~~~
/*

  • Your Stylesheet
    *
  • This stylesheet is loaded when Atom starts up and is reloaded automatically
  • when it is changed and saved.
    *
  • Add your own CSS or Less to fully customize Atom.
  • If you are unfamiliar with Less, you can read more about it here:
  • http://lesscss.org
    */

/*

  • Examples
  • (To see them, uncomment and save)
    */

// style the background color of the tree view
.tree-view {
// background-color: whitesmoke;
}

// style the background and foreground colors on the atom-text-editor-element itself
atom-text-editor {
// color: white;
// background-color: hsl(180, 24%, 12%);
}

// To style other content in the text editor's shadow DOM, use the ::shadow expression
atom-text-editor::shadow .cursor {
// border-color: red;
}

/*

  • markdown-preview-enhanced custom style
    */
    .markdown-preview-enhanced-custom {
    // please write your custom style here
    // eg:
    // color: blue; // change font color
    // font-size: 14px; // change font size
    //

// custom pdf output style

h1 {
counter-reset: h2counter;
}
h2 {
counter-increment: h2counter;
counter-reset: h3counter;
}
h3 {
counter-increment: h3counter;
counter-reset: h4counter;
}
h4 {
counter-increment: h4counter;
}
h2:before {
content: counter(h2counter) ". ";
}
h3:before {
content: counter(h2counter) "." counter(h3counter) ". ";
}
h4:before {
content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) ". ";
}
@media print {

}

// custom phantomjs png/jpeg export style
&.phantomjs-image {

}

//custom phantomjs pdf export style
&.phantomjs-pdf {

}

// custom presentation style
.preview-slides .slide,
&[data-presentation-mode] {
// eg
// background-color: #000;
}
}

// please don't modify the .markdown-preview-enhanced section below
.markdown-preview-enhanced {
.markdown-preview-enhanced-custom() !important;
}

~~~

All 2 comments

you can try this.

~~~
/*

  • Your Stylesheet
    *
  • This stylesheet is loaded when Atom starts up and is reloaded automatically
  • when it is changed and saved.
    *
  • Add your own CSS or Less to fully customize Atom.
  • If you are unfamiliar with Less, you can read more about it here:
  • http://lesscss.org
    */

/*

  • Examples
  • (To see them, uncomment and save)
    */

// style the background color of the tree view
.tree-view {
// background-color: whitesmoke;
}

// style the background and foreground colors on the atom-text-editor-element itself
atom-text-editor {
// color: white;
// background-color: hsl(180, 24%, 12%);
}

// To style other content in the text editor's shadow DOM, use the ::shadow expression
atom-text-editor::shadow .cursor {
// border-color: red;
}

/*

  • markdown-preview-enhanced custom style
    */
    .markdown-preview-enhanced-custom {
    // please write your custom style here
    // eg:
    // color: blue; // change font color
    // font-size: 14px; // change font size
    //

// custom pdf output style

h1 {
counter-reset: h2counter;
}
h2 {
counter-increment: h2counter;
counter-reset: h3counter;
}
h3 {
counter-increment: h3counter;
counter-reset: h4counter;
}
h4 {
counter-increment: h4counter;
}
h2:before {
content: counter(h2counter) ". ";
}
h3:before {
content: counter(h2counter) "." counter(h3counter) ". ";
}
h4:before {
content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) ". ";
}
@media print {

}

// custom phantomjs png/jpeg export style
&.phantomjs-image {

}

//custom phantomjs pdf export style
&.phantomjs-pdf {

}

// custom presentation style
.preview-slides .slide,
&[data-presentation-mode] {
// eg
// background-color: #000;
}
}

// please don't modify the .markdown-preview-enhanced section below
.markdown-preview-enhanced {
.markdown-preview-enhanced-custom() !important;
}

~~~

Thanks a lot, worked out just great!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yushukk picture yushukk  路  3Comments

ajstadlin picture ajstadlin  路  5Comments

franklin373 picture franklin373  路  4Comments

shd101wyy picture shd101wyy  路  4Comments

rcmalli picture rcmalli  路  4Comments