mirror of https://github.com/cheat/cheat.git
Minor revisions on #244
- When using GFM code fences, strip the last line in addition to the first - Updated `README.md` to mention the new feature - `minor` version-bump to `2.2.0`.
This commit is contained in:
parent
7abb663bf4
commit
edd7b5e806
26
README.md
26
README.md
|
@ -73,7 +73,7 @@ variable set, you may edit cheatsheets with:
|
||||||
cheat -e foo
|
cheat -e foo
|
||||||
```
|
```
|
||||||
|
|
||||||
If the 'foo' cheatsheet already exists, it will be opened for editing.
|
If the `foo` cheatsheet already exists, it will be opened for editing.
|
||||||
Otherwise, it will be created automatically.
|
Otherwise, it will be created automatically.
|
||||||
|
|
||||||
After you've customized your cheatsheets, I urge you to track `~/.cheat/` along
|
After you've customized your cheatsheets, I urge you to track `~/.cheat/` along
|
||||||
|
@ -109,13 +109,32 @@ export CHEATPATH="$CHEATPATH:/path/to/more/cheats"
|
||||||
You may view which directories are on your `CHEATPATH` with `cheat -d`.
|
You may view which directories are on your `CHEATPATH` with `cheat -d`.
|
||||||
|
|
||||||
### Enabling Syntax Highlighting ###
|
### Enabling Syntax Highlighting ###
|
||||||
`cheat` can apply syntax highlighting to your cheatsheets if so desired. To
|
`cheat` can optionally apply syntax highlighting to your cheatsheets. To enable
|
||||||
enable this feature, set a `CHEATCOLORS` environment variable:
|
syntax highlighting, export a `CHEATCOLORS` environment variable:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
export CHEATCOLORS=true
|
export CHEATCOLORS=true
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Specifying a Syntax Highlighter ####
|
||||||
|
You may manually specify which syntax highlighter to use for each cheatsheet by
|
||||||
|
wrapping the sheet's contents in a [Github-Flavored Markdown code-fence][gfm].
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
```sql
|
||||||
|
-- to select a user by ID
|
||||||
|
SELECT *
|
||||||
|
FROM Users
|
||||||
|
WHERE id = 100
|
||||||
|
```
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
If no syntax highlighter is specified, the `bash` highlighter will be used by
|
||||||
|
default.
|
||||||
|
|
||||||
|
|
||||||
See Also:
|
See Also:
|
||||||
---------
|
---------
|
||||||
- [Enabling Command-line Autocompletion][autocompletion]
|
- [Enabling Command-line Autocompletion][autocompletion]
|
||||||
|
@ -124,5 +143,6 @@ See Also:
|
||||||
|
|
||||||
[autocompletion]: https://github.com/chrisallenlane/cheat/wiki/Enabling-Command-line-Autocompletion
|
[autocompletion]: https://github.com/chrisallenlane/cheat/wiki/Enabling-Command-line-Autocompletion
|
||||||
[dotfiles]: http://dotfiles.github.io/
|
[dotfiles]: http://dotfiles.github.io/
|
||||||
|
[gfm]: https://help.github.com/articles/creating-and-highlighting-code-blocks/
|
||||||
[installing]: https://github.com/chrisallenlane/cheat/wiki/Installing
|
[installing]: https://github.com/chrisallenlane/cheat/wiki/Installing
|
||||||
[related-projects]: https://github.com/chrisallenlane/cheat/wiki/Related-Projects
|
[related-projects]: https://github.com/chrisallenlane/cheat/wiki/Related-Projects
|
||||||
|
|
|
@ -42,7 +42,7 @@ from docopt import docopt
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# parse the command-line options
|
# parse the command-line options
|
||||||
options = docopt(__doc__, version='cheat 2.1.28')
|
options = docopt(__doc__, version='cheat 2.2.0')
|
||||||
|
|
||||||
# list directories
|
# list directories
|
||||||
if options['--directories']:
|
if options['--directories']:
|
||||||
|
|
|
@ -21,9 +21,9 @@ def colorize(sheet_content):
|
||||||
return sheet_content
|
return sheet_content
|
||||||
|
|
||||||
first_line = sheet_content.splitlines()[0]
|
first_line = sheet_content.splitlines()[0]
|
||||||
lexer = get_lexer_by_name('bash')
|
lexer = get_lexer_by_name('bash')
|
||||||
if first_line.startswith('```'):
|
if first_line.startswith('```'):
|
||||||
sheet_content = '\n'.join(sheet_content.split('\n')[1:])
|
sheet_content = '\n'.join(sheet_content.split('\n')[1:-2])
|
||||||
try:
|
try:
|
||||||
lexer = get_lexer_by_name(first_line[3:])
|
lexer = get_lexer_by_name(first_line[3:])
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -3,7 +3,7 @@ import os
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name = 'cheat',
|
name = 'cheat',
|
||||||
version = '2.1.28',
|
version = '2.2.0',
|
||||||
author = 'Chris Lane',
|
author = 'Chris Lane',
|
||||||
author_email = 'chris@chris-allen-lane.com',
|
author_email = 'chris@chris-allen-lane.com',
|
||||||
license = 'GPL3',
|
license = 'GPL3',
|
||||||
|
|
Loading…
Reference in New Issue