Title: | Style Python code blocks with black |
---|---|
Description: | RStudio addin to help format and style Python code in RMarkdown and Quarto documents with the Python code formatter, black. |
Authors: | person("Eric", "Leung", email = "[email protected]", role = c("aut", "cre")) |
Maintainer: | Eric Leung <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-11-14 04:29:40 UTC |
Source: | https://github.com/erictleung/pyblack |
Assumes file is a standard RMarkdown or Quarto document with Python-labeled code blocks.
style_active_file_black()
style_active_file_black()
Code credit: Alex Rossell Hayes (https://github.com/rossellhayes)
Takes Python code directly into the function and formats it with black.
style_black(code)
style_black(code)
code |
character text of Python code |
character formatted Python code
Apply black formatting to highlighted code
style_black_selection()
style_black_selection()
None
To give another option for consistency if you want to use 2 spaces for Python
style_python_two_spaces()
style_python_two_spaces()
None