Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docstrings are treated as regular strings if they are indented #111

Open
ericproffitt opened this issue Aug 23, 2021 · 4 comments
Open

Docstrings are treated as regular strings if they are indented #111

ericproffitt opened this issue Aug 23, 2021 · 4 comments

Comments

@ericproffitt
Copy link

Docstrings are treated as regular strings if they are indented,

Screen Shot 2021-08-23 at 12 12 31 AM

Is there a way to fix this?

@randy3k
Copy link
Collaborator

randy3k commented Aug 23, 2021

It is intended. Doc strings have to be at the top level.

@ericproffitt
Copy link
Author

@randy3k do you mean at the top indentation level? why is that?

@fsaad
Copy link

fsaad commented Feb 1, 2023

Julia does support doc strings which are not at the top level and where it is natural to use indentation, e.g.,

Example 1: doc strings for entities inside a module, perhaps nested

image

#Example 2: doc strings for inner constructors using the @doc macro as described here.

image

For Example 2, it seems we should be able to recognize when @doc is being used to define a doc string and highlight appropriately. That would also help with Example 1, where the user can write @doc before the indented doc string to produce the desired syntax highlighting.

@fsaad
Copy link

fsaad commented Feb 2, 2023

It does seem possible to force a docstring using "@doc raw"

- match: ^\s*(?=(@doc\s+raw"""|^(raw)?"""|^"(?:.*"$)))

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants