Overview¶
CSharp (C#) domain for Sphinx.
Installing¶
Install the extension using pip:
pip install sphinxsharp
Or install extension with custom styling:
pip install sphinxsharp-pro
Note
This documentation using a sphinxsharp-pro extension.
Usage¶
To enable the extension, you need to add the following to your conf.py:
extensions = ['sphinxsharp.sphinxsharp'] # for sphinxsharp with default styling
extensions = ['sphinxsharp-pro.sphinxsharp'] # for sphinxsharp with custom styling
Note
With custom styling you can define your styles (colors etc.) for syntax highlightning using css.
In your .rst documents you can use it with explicit directive declaration:
.. sphinxsharp:type:: public class Example
Or for shorter version, define this domain as default:
.. default-domain:: sphinxsharp
.. type:: public class Example
See also
See also list of available Directives.
Custom styling¶
With sphinxsharp-pro you can do your custom styling for syntax highlightning etc., by overriding some styles of extension.
Create new file sphinxsharp-override.css in your source/_static folder, and override styles what you need.
Hint
Use !important for higher override priority, if without it nothing happend.
Example of default custom styling:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | dl.csharp > dt {
border-radius: 10px !important;
border: 0px !important;
padding: 10px !important;
}
dl.csharp > dd p:not([class]) {
font-size: 14px;
color: rgb(80, 80, 80);
margin: 5px 0px 7px 10px !important;
}
dl.csharp > dd div p {
font-size: 16px !important;
}
dl.csharp .docutils.field-list tr.field > th, td {
padding: 3px 5px 0px 0px !important;
}
.csharp .desc > .first {
font-size: 14px;
margin-right: 18px;
color: #404040;
}
.csharp .desc > .last {
font-size: 13.5px;
}
.csharp .mod {
font-weight: bold;
color: #404040;
}
.csharp.method .desc > .first, .csharp.enum .desc:not(:first-of-type) > .first {
background-color: #e7f2fa;
padding: 4px;
border-radius: 5px;
margin-right: 10px;
}
.csharp.method .desc > .last, .csharp.enum .desc > .last {
font-weight: bold;
}
.csharp.method .desc, .csharp.enum .desc {
margin-bottom: 5px;
}
.csharp .unknown {
color: #2980B9;
}
.csharp .class {
font-weight: bold;
color: #2980B9;
}
.csharp .struct {
font-weight: bold;
color: #0a99f8;
}
.csharp .interface {
font-weight: bold;
color: #2980B9;
}
.csharp .enum {
font-weight: bold;
color: cornflowerblue;
}
.csharp .text {
color: #404040;
}
.csharp .kw {
color: #404040;
font-weight: bold;
}
.csharp .meth-name {
color: #404040;
}
.csharp .delegate {
color: #404040;
}
.csharp .var-name {
color: #404040;
}
.csharp .generic {
color: #2980B9;
}
.csharp .reference.internal:visited{
color: unset !important;
}
|