alex-shpak / hugo-book

Hugo documentation theme as simple as plain book
https://hugo-book-demo.netlify.app
MIT License
3.21k stars 1.16k forks source link

change formatting of markdown heading #606

Closed smillas-snow closed 4 months ago

smillas-snow commented 4 months ago

Hi, Sorry, this might seem like a stupid question, but I am not very familiar with html.

Could you guide me to some help on how to adjust the formatting of page headings (e.g. 1. level: bold + horizontal line below; colour; ...)? Maybe something like, in which file would I have to do this and maybe a sample code, so I have a start to figure things out. Same goes for formatting the left menu/book Toc. Can I adjust it based on level (e.g. 1. level: bold; 2. level: normal; 3. level: italic)?

Thanks for your help.

alex-shpak commented 4 months ago

Hi! So, there is _custom.scss file, whoch is empty by default, you can put your css styles there.

This file defines all styles for markdown page, highlighted lines are heading styles https://github.com/alex-shpak/hugo-book/blob/master/assets/_markdown.scss#L11-L47

Here are styles for navigation lists, includes both left and right https://github.com/alex-shpak/hugo-book/blob/master/assets/_main.scss#L45

but you can put your styles for TOC in #TableOfContents as it is what hugo generates

alex-shpak commented 4 months ago

as for levels you will have to go with nesting rules in CSS here is some inspiration with numbered lists https://github.com/alex-shpak/hugo-book/blob/master/assets/plugins/_numbered.scss

smillas-snow commented 4 months ago

Thank you for the pointers and help. I will have a look and play around a bit.

smillas-snow commented 4 months ago

I have tried to follow your example and hints given in other issues, but I can't seem to get it to work. Am I missing something? image

smillas-snow commented 4 months ago

I found my mistake. I compiled with hugo -D serve which doesn't work. But compiling with hugo server --disableFastRender makes it work.