Skip to content

Commit 6f46fe3

Browse files
committed
style code blocks
1 parent 328312d commit 6f46fe3

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

coding/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ shown below.
321321
#include "spinlock.h"
322322
#include "string.h"
323323
#include "console.h"
324-
#include "stm32.h
324+
#include "stm32.h"
325325
```
326326

327327
It is advised not to use MACROS in the code.

conf.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,15 @@
5555
\usepackage[english]{babel}
5656
\usepackage{fancyhdr}
5757
\usepackage{tikz} % Add this for drawing the circle
58+
\usepackage{fancyvrb}
59+
\usepackage{framed}
5860
''',
5961
'preamble': r'''
6062
\setmainfont{Liberation Sans}
6163
\addtolength{\cftsubsecnumwidth}{4pt}
6264
\setcounter{secnumdepth}{3}
6365
\definecolor{ps-orange}{HTML}{ea5b22}
66+
\definecolor{lightgray}{RGB}{245, 245, 245}
6467
\addto\captionsenglish{\renewcommand{\contentsname}{\textcolor{ps-orange}{Table of contents}}}
6568
6669
% Define the fancy page style
@@ -75,6 +78,35 @@
7578
\renewcommand{\headrulewidth}{0pt} % Remove header line
7679
}
7780
81+
% Code block styling
82+
\usepackage{listings}
83+
\definecolor{lightgray}{RGB}{248,248,248}
84+
85+
% Override Sphinx verbatim settings
86+
\fvset{
87+
frame=none,
88+
numbers=none,
89+
fontfamily=ttfamily,
90+
baselinestretch=1.2
91+
}
92+
% Sphinx-specific settings
93+
\sphinxsetup{
94+
VerbatimColor={rgb}{0.97,0.97,0.97}, % Background color for code blocks
95+
VerbatimBorderColor={rgb}{0.97,0.97,0.97}, % Make border same as background
96+
verbatimwithframe=false,
97+
verbatimsep=8pt,
98+
verbatimborder=0pt % Set border width to 0
99+
}
100+
101+
% Additional frame removal
102+
\renewenvironment{Verbatim}{%
103+
\setlength{\fboxsep}{0pt}%
104+
\setlength{\fboxrule}{0pt}%
105+
\begin{flushleft}%
106+
}{%
107+
\end{flushleft}%
108+
}
109+
78110
% Apply the style to all pages
79111
\pagestyle{normal}
80112
''',

0 commit comments

Comments
 (0)