Is there a way to format code in a Python session started from TeXmacs? For example, if I do Insert => Session => Python
and write the code shown below, then the code is formatted nicely, until the last line return arr
:
def sort_array(arr):
n = len(arr)
# Bubble Sort algorithm
for i in range(n):
for j in range(0, n-i-1):
# Swap if the element found is greater than the next element
if arr[j] > arr[j+1]:
arr[j], arr[j+1] = arr[j+1], arr[j]
return arr # this line is note formatted properly in TeXmacs, I have to manually format it
Is there a way to autoformat code in TeXmacs? Of course, one work around is write the code in an editor such as vscode and then paste it in TeXmacs, but I was wondering if any internal plugin is available to do that.