This page acts as a good example of using reST, along with some common format constructs that you can use elsewhere. Think of it like a cheatsheet.
This is the start of a chapter, which is like a big section. You can talk about the main idea here. For instance, we can talk about the cute and shy Hifumi Takimoto. You should use this section quite a lot, as it’s the main heading that splits topics apart.
Uses h3 headings and is used for a sub-section. If the chapter consists of numerous sections, use this to help break it down further, such as explaining a smaller portion in the overall chapter. Note that we’re using a different heading to help denote that this is a different kind of section. reST has that kind of foresight.
The biggest appeal with this section is that it gives breathing room, but isn’t a large-scale split like the previous one is.
As if that isn’t enough, here’s a smaller section. Smaller bits of content are appropriate here. This should be used rarely.
This will be the smallest title possible, but I don’t think we’d really want to use this one.
Note
Be sure to keep an eye out in being consistent with the characters. The levels used are going to be “=, -, ~, .” from biggest to smallest. Also note that your headings’ characters need to match the length of the line! Sphinx will complain upon compilation otherwise!
We hope that this helped demonstrate the hierarchy of sections!
Various table directives are possible too. Here we’ll show two kinds of tables: the default reST table and CSV tables.
| Employee | Role |
|---|---|
| Kashou Mindauki | Owner |
| Chocola | Waitress |
| Vanilla | Waitress |
But sometimes this formatting is inconvenient to type. So here’s a CSV table. For more details, refer to here.
| Username | Server Role |
|---|---|
| BetaStar | Founder |
| Exile- | Founder |
| Starrodkirby86 | Mentor |
| Damnae | Mentor |
| Naxess | Mentor |
You can cross reference text as well. It works similarly to a GOTO, where you simply label the section you want to redirect, and then refer it like this: Special Formatting Nougats.
There’s a specific naming convention to follow when it comes to creating cross-referencing labels. Because all reference labels are global, a naming conflict is bound to occur, or it can be confusing exactly where you’re going when there’s many pages in the documentation. To fix this, names are based on their subfolders to file then to section name. An example would be storyboarding_scripting_compound_commands_loop.
You can also refer to other documents, such as this example to refer back to the overview page. Meta Content.
For more details, refer to this link.
Sometimes in our text, we’d like to write little other blurbs that act as special info bonuses. You’ve seen one earlier with the Note title. Here’s some other blocks you can use! Do note that the only ones that are themed in with this website are listed in this example page, so while other admonitions exist in Sphinx, these are the only ones that are supported.
Note
This is a note admonition. The note is used for additional remarks that may be good to know for the section at hand. Use this if you want to...
Warning
This is a warning admonition! Dangerous! Spooky! Warnings are scary! Hifumi gets really scared when she sees warnings. She knows that there can be a common error that can be avoided, had she heeded this warning. Use the warning admonition to:
Tip
This is a tip admonition. It’s pretty cute. I think we all love protips. I think this one speaks for itself, but if you want to use the tip admonition, here are some sample usages:
Attention
This is an attention admonition. This should be placed at the beginning of a document, maybe if it’s unfinished or if there’s something to say. Wikipedia does this. So here are some sample usages:
Hint
This is a hint admonition. This is meant for stuff like self-quizzing, if you ever wanted to do that. I guess for the sake of education that sounds kind of cute. Sample usages:
Example of a code-block using C#.
Warning
A lot of this code is full of maximum fun!
Color4 a and Color4 b.¶1 2 3 4 5 6 7 | public Color4 ColorLerp(Color4 a, Color4 b, float blend)
{
var vectorColorA = new Vector3(a.R,a.G,a.B);
var vectorColorB = new Vector3(b.R,b.G,b.B);
var v = Vector3.Lerp(vectorColorA,vectorColorB,blend);
return new Color4(v.X,v.Y,v.Z,255);
}
|
This example demonstrates highlighting a certain line, and also demonstrates starting a line number from a specific spot. (But the specific line is non-relative to the lineno-start value!)
46 47 48 | public static int manhattanDistance(Coord a, Coord b) {
return Math.Abs(b.x - a.x) + Math.Abs (b.y - a.y);
}
|
This example demonstrates Python highlighting.
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 | def search(n):
def isTooHeavy(cs):
cs >= success.moves
x = int(n)
pq = PriorityQueue()
pq.push( PelletState(x), 0 )
visited = []
success = PelletState(1, 99999999)
while pq._queue:
currentState = pq.pop()
# print( str(currentState.moves) )
if not (currentState in visited) and currentState.moves <= success.moves:
visited.append(currentState)
if currentState.pellets == 1:
return currentState
# success = currentState if currentState.moves < success.moves else success
else:
if not isTooHeavy(currentState.moves+1):
if not currentState.addFlag:
pq.push( currentState.AddOne(), currentState.moves+1 )
if currentState.pellets % 2 == 0:
pq.push( currentState.DivideGroup(), currentState.moves+1 )
pq.push( currentState.RemoveOne(), currentState.moves+1 )
return success
|