Package 'pyblack'

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-09-15 05:01:38 UTC
Source: https://github.com/erictleung/pyblack

Help Index


Style entire active file

Description

Assumes file is a standard RMarkdown or Quarto document with Python-labeled code blocks.

Usage

style_active_file_black()

Details

Code credit: Alex Rossell Hayes (https://github.com/rossellhayes)


Style Python Code directly

Description

Takes Python code directly into the function and formats it with black.

Usage

style_black(code)

Arguments

code

character text of Python code

Value

character formatted Python code


Apply black formatting to highlighted code

Description

Apply black formatting to highlighted code

Usage

style_black_selection()

Value

None


Replace Python indentation from 4 to 2

Description

To give another option for consistency if you want to use 2 spaces for Python

Usage

style_python_two_spaces()

Value

None