diff --git a/doc_src/FORMATTING.md b/doc_src/FORMATTING.md index 4b4b23381..5ab4e6acf 100644 --- a/doc_src/FORMATTING.md +++ b/doc_src/FORMATTING.md @@ -154,14 +154,15 @@ The following can be used in \\fish blocks to render some fish scenarios. These ### Custom formatting tags -- ``: auto\suggestion\. -- ``: \Matched\ items, such as tab completions. -- ``: Matched items \searched\ for, like grep results. -- ``: \This would be shown as an error.\ -- ``: \This text will not be parsed for fish markup.\ -- ``: Render the contents with a preceding backslash. Useful when presenting output. - `{{` and `}}`: Required when wanting curly braces in regular expression example. +- `\\asis`: \\asis\{This text will not be parsed for fish markup.\} +- `\\bksl`: \\bksl\{Render the contents with a preceding backslash. Useful when presenting output.} +- `\\eror`: \\eror\{This would be shown as an error.\} +- `\\mtch`: \\mtch\{Matched\} items, such as tab completions. - `\\outp`: \\outp\{This would be rendered as command/script output.\} +- `\\sgst`: auto\\sgst\{suggestion\}. +- `\\smtc`: Matched items \\smtc\{searched\} for, like grep results. +- `\\undr`: \\undr\{These words are underlined\}. ### Prompts and cursors diff --git a/doc_src/index.hdr.in b/doc_src/index.hdr.in index 64ed2eb79..c06d39d89 100644 --- a/doc_src/index.hdr.in +++ b/doc_src/index.hdr.in @@ -70,7 +70,7 @@ rm "cumbersome filename.txt" Will remove the file 'cumbersome filename.txt', while \fish -rm cumbersome filename.txt +rm \asis{cumbersome filename.txt} \endfish would remove the two files 'cumbersome' and 'filename.txt'. diff --git a/doc_src/string.txt b/doc_src/string.txt index 5a7b6f37e..31677858e 100644 --- a/doc_src/string.txt +++ b/doc_src/string.txt @@ -103,7 +103,7 @@ The following subcommands are available: \fish{cli-dark} >_ echo \\x07 | string escape -cg +\bksl{cg} \endfish \subsection string-example-match-glob Match Glob Examples @@ -136,7 +136,7 @@ The following subcommands are available: >_ string match -r 'cat|dog|fish' 'nice dog' \outp{dog} ->_ string match -r '(\\d\\d?):(\\d\\d):(\\d\\d)' 2:34:56 +>_ string match -r '(\\d\\d?):(\\d\\d):(\\d\\d)' \asis{2:34:56} \outp{2:34:56} \outp{2} \outp{34} diff --git a/doc_src/tutorial.hdr b/doc_src/tutorial.hdr index 9c94cca35..8442b9054 100644 --- a/doc_src/tutorial.hdr +++ b/doc_src/tutorial.hdr @@ -56,7 +56,7 @@ When you start `fish`, you should see this: \fish{cli-dark} \outp{Welcome to fish, the friendly interactive shell} \outp{Type help for instructions on how to use fish} -you@hostname ~>____ +\asis{you@hostname} ~>____ \endfish `fish` comes with a default prompt that shows your username, hostname, and working directory. You'll see how to change your prompt further down. From now on, we'll pretend your prompt is just a '`>`' to save space. @@ -99,7 +99,7 @@ Commands can be chained with semicolons. You'll quickly notice that `fish` performs syntax highlighting as you type. Invalid commands are colored red by default: \fish{cli-dark} ->_ /bin/mkd +>_ \eror{/bin/mkd} \endfish 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: @@ -111,7 +111,7 @@ A command may be invalid because it does not exist, or refers to a file that you `fish` will underline valid file paths as you type them: \fish{cli-dark} ->_ cat ~/somefi___ +>_ cat \undr{~/somefi}___ \endfish This tells you that there exists a file that starts with '`somefi`', which is useful feedback as you type. @@ -170,19 +170,19 @@ stdin and stdout can be redirected via the familiar < and >. Unlike other `fish` suggests commands as you type, and shows the suggestion to the right of the cursor, in gray. For example: \fish{cli-dark} ->_ /bin/h___ostname +>_ \eror{/bin/h}\sgst{___ostname} \endfish It knows about paths and options: \fish{cli-dark} ->_ grep --i___gnore-case +>_ grep --i\sgst{___gnore-case} \endfish And history too. Type a command once, and you can re-summon it by just typing a few letters: \fish{cli-dark} ->_ r___sync -avze ssh . myname@somelonghost.com:/some/long/path/doo/dee/doo/dee/doo +>_ \eror{r<}\sgst{___sync -avze ssh . myname@somelonghost.com:/some/long/path/doo/dee/doo/dee/doo} \endfish To accept the autosuggestion, hit @cursor_key{→,right arrow} or @key{Control,F}. To accept a single word of the autosuggestion, @key{Alt,→} (right arrow). If the autosuggestion is not what you want, just ignore it. @@ -194,14 +194,14 @@ To accept the autosuggestion, hit @cursor_key{→,right arrow} or @key{Contro Press @key{Tab}, and `fish` will attempt to complete the command, argument, or path: \fish{cli-dark} ->_ /pri @key{Tab} → /private/ +>_ \eror{/pri} @key{Tab} → /private/ \endfish If there's more than one possibility, it will list them: \fish{cli-dark} ->_ ~/stuff/s @key{Tab} -\outp{~/stuff/script.sh (Executable, 4.8kB) ~/stuff/sources/ (Directory)} +>_ \eror{~/stuff/s} @key{Tab} +\outp{\mtch{~/stuff/s}cript.sh (Executable, 4.8kB) \mtch{~/stuff/s}ources/ (Directory)} \endfish Hit tab again to cycle through the possibilities. @@ -211,7 +211,7 @@ Hit tab again to cycle through the possibilities. \fish{cli-dark} >_ git merge pr @key{Tab} → git merge prompt_designer >_ git checkout b @key{Tab} -\outp{builtin_list_io_merge (Branch) builtin_set_color (Branch) busted_events (Tag)} +\outp{\mtch{b}uiltin_list_io_merge (Branch) \mtch{b}uiltin_set_color (Branch) \mtch{b}usted_events (Tag)} \endfish Try hitting tab and see what `fish` can do! @@ -275,7 +275,7 @@ Unlike other shells, `fish` does not have an export command. Instead, a variable \fish{cli-dark} >_ set -x MyVariable SomeValue >_ env | grep MyVariable -\outp{MyVariable=SomeValue} +\outp{\smtc{MyVariablem}=SomeValue} \endfish You can erase a variable with `-e` or `--erase` @@ -506,7 +506,7 @@ You can define your own prompt: >_ function fish_prompt echo "New Prompt % " end -New Prompt % ___ +\asis{New Prompt % }___ \endfish Multiple lines are OK. Colors can be set via `set_color`, passing it named ANSI colors, or hex RGB values: diff --git a/lexicon_filter.in b/lexicon_filter.in index 13e8b6d79..b618a1b78 100644 --- a/lexicon_filter.in +++ b/lexicon_filter.in @@ -72,7 +72,16 @@ b html } # Preprocess specially recognized commands. + s/\\asis/@asis/g + s/\\bksl/@bksl/g + s/\\bold/@bold/g + s/\\emph/@emph/g + s/\\eror/@eror/g + s/\\mtch/@mtch/g s/\\outp/@outp/g + s/\\sgst/@sgst/g + s/\\smtc/@smtc/g + s/\\undr/@undr/g # Process the rest b process } @@ -96,7 +105,7 @@ s||@bold{| s|]*>|@bold{| s||}| #. -# Strong (synonimous with emphasis) +# Strong (synonymous with emphasis) s||@bold{| s|]*>|@bold{| s||}| @@ -115,39 +124,7 @@ s||}| s||@undr{| s|]*>|@undr{| s||}| -# Backslash (when escaping output) -s||@bksl{| -s||}| -t html #. -# Some handy non-standard extensions -# autoSuGgeSTion -s||@sgst{| -s|]*>|@sgst{| -s||}| -#. -# MaTCH -s||@mtch{| -s|]*>|@mtch{| -s||}| -#. -# SearchMaTCh -s||@smtc{| -s|]*>|@smtc{| -s||}| -#. -# ERrOR -s||@eror{| -s|]*>|@eror{| -s||}| -#. -# AsIs - protect from auto-formatting -s||@asis{| -s||}| -#. -# OUTPut - protect from auto-formatting -s||@outp{| -s||}| t html #. # Clean other unhandled html