godot-rust / gdext

Rust bindings for Godot 4
https://mastodon.gamedev.place/@GodotRust
Mozilla Public License 2.0
3.18k stars 200 forks source link

Docs comments do not follow usual markdown newline rules #811

Open RedMser opened 4 months ago

RedMser commented 4 months ago

In pretty much every markdown implementation I know, a single newline is either treated as a newline or silently ignored.

So when adding a documentation comment to a member like

/// docs for speed
/// with newline
/// 
/// and with paragraph
#[var]
speed: f64,

I expect Godot's documentation viewer to either render like

docs for speed
with newline

and with paragraph

or like

docs for speed with newline

and with paragraph

However, godot-rust markdown parser seems to convert newlines to paragraphs as well:

image

I don't mind which style ends up being chosen here, but the current behavior does not seem correct. Very long lines of documentation are usually split into multiple lines, which would end up creating a lot of paragraphs mid-sentence.


For reference, VSCode ignores newlines and treats double newline as a paragraph.

image

GDScript documentation

## docs for speed
## with newline
##
## and with paragraph

ignores all kinds of newlines (converting newlines to spaces), and is expecting you to write [br] instead.

Bromeon commented 4 months ago

Thanks for reporting! https://github.com/godot-rust/gdext/pull/748 was merged only 18h ago, we're aware it's an initial version and not the perfect one yet. But that doesn't have to stay like this πŸ˜‰

Would you be interested in opening a pull request to address the issues you mentioned? Let us know if you need some guidance.

RedMser commented 4 months ago

I could have a look at it, though I have not contributed to this project yet. If someone else is willing and interested though, I won't stop them ^^

EDIT: I'm getting a lot of confusing compile errors just trying to run the unit tests, so I'll drop this until I have more time.

Bromeon commented 4 months ago

This issue might be a great place to start πŸ˜‰ of course only if you want and have the time. As mentioned, in case you need any support or guidance, let us know (either here or on Discord) πŸ‘

Yarwin commented 4 months ago

I can take care of it after #815

Bromeon commented 2 months ago

@RedMser or @Yarwin is there still interest in this?

RedMser commented 2 months ago

I'm busy with work so @Yarwin is free to work on it if they want. But the issue should definitely be fixed to help readability of docs.