Skip to content

Commit 77f5e24

Browse files
add description of custom yapf styles to readme
1 parent b48c539 commit 77f5e24

File tree

1 file changed

+17
-0
lines changed
  • src/jupyter_contrib_nbextensions/nbextensions/code_prettify

1 file changed

+17
-0
lines changed

src/jupyter_contrib_nbextensions/nbextensions/code_prettify/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,20 @@ to use [autopep8] instead of [yapf] to reformat the python code.
239239
But, if you want two alternative prettifiers available for the same kernel
240240
language, we need to define separate plugins.
241241

242+
Custom Yapf Styles
243+
------------------
244+
245+
Using the default `yapf` engine, one may define a custom formatting style according to the [package documentation](https://github.com/google/yapf#formatting-style).
246+
247+
The `code_prettify` extension is configured to follow the default `yapf` ordering (minus the command line option) and will search for the formatting style in the following manner:
248+
249+
> 1. In the [style] section of a .style.yapf file in either the current directory or one of its parent directories.
250+
> 2. In the [yapf] section of a setup.cfg file in either the current directory or one of its parent directories.
251+
> 3. In the ~/.config/yapf/style file in your home directory.
252+
>
253+
> If none of those files are found, the default style is used (PEP8).
254+
255+
This means that one can set up a globa custom yapf style using `~/.config/yapf/style` or a project-specific one using the project directory.
242256

243257
History
244258
-------
@@ -267,6 +281,9 @@ History
267281
- [@jfbercher], january 2017
268282
- updated documentation
269283
- added autopep8 nbextension as a plugin using the shared library
284+
- [@artificialsoph], Jan 2018
285+
- updated documentation
286+
- changed default behavior to load custom yapf styles
270287

271288

272289
[2to3]: README_2to3.md

0 commit comments

Comments
 (0)