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

Trying to understand relationship between margin and format_docstrings #649

Open
danielsoutar opened this issue Oct 25, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@danielsoutar
Copy link

Straightforward question: does setting margin to 80 characters apply to docstrings as well if format_docstrings is set to true?

Environment:
VSCode, using the Julia extension (v1.38.2)

Format config options:
style = "blue"
margin = 80
trailing_comma = true
import_to_using = false
remove_extra_newlines = false
format_docstrings = true

Before:

"""
    some_really_long_function_name!(really_long_arg_a, argument_named_b)::Nothing

Do nothing and make a really big deal out of it. For more details see https://www.example.com/.

# Arguments

- `really_long_arg_a`: First argument
- `argument_named_b`: Second argument

"""
function some_really_long_function_name!(really_long_arg_a, argument_named_b)::Nothing
    nothing    
end

After:

"""
    some_really_long_function_name!(really_long_arg_a, argument_named_b)::Nothing  # still over 80 characters

Do nothing and make a really big deal out of it. For more details see https://www.example.com/  # still over 80 characters

# Arguments

  - `really_long_arg_a`: First argument
  - `argument_named_b`: Second argument
"""
function some_really_long_function_name!(
    really_long_arg_a, argument_named_b
)::Nothing
    return nothing
end

Both the signature and first line exceed the margin, and yet neither are formatted. Is this intentional? I understand if CommonMark takes care of formatting markdown, but this section in the README would lead me to think that this is unexpected:

format_docstrings
default: false
Format code docstrings with the same options used for the code source.
Markdown is formatted with CommonMark alongside Julia code.

@domluna
Copy link
Owner

domluna commented Nov 10, 2022

I'm guessing the signature is not being interpreted as a code block

@domluna domluna added the bug Something isn't working label Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants