Any way to preserve indentation characters in raw code?

As an example, if I create a PDF using following code:

```py
def test_fn():
  # I want this indentation preserved
  print("123")
```

I get the following output:

This looks nice and all, but if I try to copy this code out of the PDF, the indentation is lost:

def test_fn():
# I want this indentation preserved
print("123")

which is rather unfortunate for python code.
Is there any way to preserve the indentation characters?

1 Like

This is a PDF viewer issue. See https://github.com/typst/typst/issues/671#issuecomment-1502938789.