From b5cbdc623d6ef0b812826d91c577addd5aef8776 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sat, 22 Feb 2020 18:01:05 +0100 Subject: [PATCH] docs/tutorial: Replace coloring markup This used to use doxygen's html blocks, which don't have a *direct* equivalent in sphinx in code blocks. Instead of adding this to the pygments highlighter, let's just use some roles. It's a teensy bit awkward as we then use block styling, but we want to add more of our own styling anyway, so we can presumably get this somehow, and these html tags look awkward and confuse people. Fix #6640 [ci skip] --- doc_src/_static/pygments.css | 3 +++ doc_src/tutorial.rst | 34 +++++++++++++++++++--------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/doc_src/_static/pygments.css b/doc_src/_static/pygments.css index 02625b7e8..7ed4401d2 100644 --- a/doc_src/_static/pygments.css +++ b/doc_src/_static/pygments.css @@ -79,3 +79,6 @@ .highlight .il { color: #0000cf; font-weight: bold } /* Literal.Number.Integer.Long */ .purple { color: #551a8b } .yellow { color: #FFFF00 } +.red { color: #FF0000 } +.gray { color: #555555 } +.underline { text-decoration: underline } diff --git a/doc_src/tutorial.rst b/doc_src/tutorial.rst index e6af7dcc3..3a0be43d8 100644 --- a/doc_src/tutorial.rst +++ b/doc_src/tutorial.rst @@ -82,19 +82,23 @@ Getting Help Syntax Highlighting ------------------- -You'll quickly notice that ``fish`` performs syntax highlighting as you type. Invalid commands are colored red by default:: +.. role:: red +.. role:: gray +.. role:: underline - > /bin/mkd +You'll quickly notice that ``fish`` performs syntax highlighting as you type. Invalid commands are colored red by default +> :red:`/bin/mkd` + A command may be invalid because it does not exist, or refers to a file that you cannot execute. When the command becomes valid, it is shown in a different color:: > /bin/mkdir -``fish`` will underline valid file paths as you type them:: +``fish`` will underline valid file paths as you type them - > cat ~/somefi +> cat :underline:`~/somefi` This tells you that there exists a file that starts with '``somefi``', which is useful feedback as you type. @@ -156,19 +160,19 @@ To redirect stdout and stderr into one file, you need to first redirect stdout, Autosuggestions --------------- -``fish`` suggests commands as you type, and shows the suggestion to the right of the cursor, in gray. For example:: +``fish`` suggests commands as you type, and shows the suggestion to the right of the cursor, in gray. For example - > /bin/hostname +> :red:`/bin/h`:gray:`ostname` -It knows about paths and options:: +It knows about paths and options - > grep --ignore-case +`> grep --i`:gray:`gnore-case` -And history too. Type a command once, and you can re-summon it by just typing a few letters:: +And history too. Type a command once, and you can re-summon it by just typing a few letters - > rsync -avze ssh . myname@somelonghost.com:/some/long/path/doo/dee/doo/dee/doo +> :red:`r`:gray:`sync -avze ssh . myname@somelonghost.com:/some/long/path/doo/dee/doo/dee/doo` To accept the autosuggestion, hit :kbd:`→` (right arrow) or :kbd:`Control+F`. To accept a single word of the autosuggestion, :kbd:`Alt+→` (right arrow). If the autosuggestion is not what you want, just ignore it. @@ -178,15 +182,15 @@ Tab Completions ``fish`` comes with a rich set of tab completions, that work "out of the box." -Press :kbd:`Tab`, and ``fish`` will attempt to complete the command, argument, or path:: +Press :kbd:`Tab`, and ``fish`` will attempt to complete the command, argument, or path - > /pri :kbd:`Tab` => /private/ +> :red:`/pri` :kbd:`Tab` => /private/ -If there's more than one possibility, it will list them:: +If there's more than one possibility, it will list them - > ~/stuff/s :kbd:`Tab` - ~/stuff/script.sh (Executable, 4.8kB) ~/stuff/sources/ (Directory) +> :red:`~/stuff/s` :kbd:`Tab` +~/stuff/script.sh (Executable, 4.8kB) ~/stuff/sources/ (Directory) Hit tab again to cycle through the possibilities.