-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathjupyter-black.yaml
71 lines (63 loc) · 2.36 KB
/
jupyter-black.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Type: IPython Notebook Extension
Name: Jupyter Black
Description: Use Black to reformat/prettify Python code cells
Link: README.md
Main: jupyter-black.js
Compatibility: Jupyter 4.x, 5.x
Parameters:
- name: jupyter-black.add_toolbar_button
description: Add a toolbar button to prettify the selected cell(s)
input_type: checkbox
default: true
- name: jupyter-black.button_icon
description: |
Toolbar button icon: a font-awesome class defining the icon used for the
toolbar button and actions.
See https://fontawesome.com/icons for available icons.
input_type: text
default: 'fa-legal'
- name: jupyter-black.button_label
description: Toolbar button label text
input_type: text
default: 'Black'
- name: jupyter-black.register_hotkey
description: |
Register hotkeys to prettify the selected code cell(s), or all code cells
in the notebook
input_type: checkbox
default: true
- name: jupyter-black.hotkeys.process_selected
description: Hotkey to use to prettify the selected cell(s)
input_type: hotkey
default: 'Ctrl-B'
- name: jupyter-black.hotkeys.process_all
description: Hotkey to use to prettify the whole notebook
input_type: hotkey
default: 'Ctrl-Shift-B'
- name: jupyter-black.show_alerts_for_not_supported_kernel
description: Show alerts if the kernel is not supported
input_type: checkbox
default: false
- name: jupyter-black.show_alerts_for_errors
description: Show alerts for errors in the kernel prettifying calls
input_type: checkbox
default: true
- name: jupyter-black.kernel_config_map_json
description: |
json defining library calls required to load the kernel-specific
prettifying modules, and the prefix & postfix for the json-format string
required to make the prettifying call.
input_type: textarea
default: |
{
"python": {
"library": "import json\ndef black_reformat(cell_text):\n import black\n import re\n cell_text = re.sub('^%', '#%#', cell_text, flags=re.M)\n reformated_text = black.format_str(cell_text, mode=black.FileMode())\n return re.sub('^#%#', '%', reformated_text, flags=re.M)",
"prefix": "print(json.dumps(black_reformat(u",
"postfix": ")))"
},
"javascript": {
"library": "jsbeautify = require('js-beautify')",
"prefix": "console.log(JSON.stringify(jsbeautify.js_beautify(",
"postfix": ")));"
}
}