You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/jupyter_contrib_nbextensions/nbextensions/code_prettify/README.md
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -239,6 +239,20 @@ to use [autopep8] instead of [yapf] to reformat the python code.
239
239
But, if you want two alternative prettifiers available for the same kernel
240
240
language, we need to define separate plugins.
241
241
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.
242
256
243
257
History
244
258
-------
@@ -267,6 +281,9 @@ History
267
281
-[@jfbercher], january 2017
268
282
- updated documentation
269
283
- 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
0 commit comments