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

bpaf_derive: use trim_start in doc_comment parser? #330

Open
bzm3r opened this issue Jan 2, 2024 · 1 comment
Open

bpaf_derive: use trim_start in doc_comment parser? #330

bzm3r opened this issue Jan 2, 2024 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@bzm3r
Copy link
Contributor

bzm3r commented Jan 2, 2024

We have at the moment:

if s.starts_with(' ') {
s = s[1..].to_string();
}

Should this just be replaced with a call to trim_start?

(I am happy to implement this, if it makes sense.)

@pacak
Copy link
Owner

pacak commented Jan 2, 2024

This part preprocesses the comment block changing it from

/// xxx
/// yyyy

giving you back "xxx" and "yyy".

But this preserves spaces past the first one so /// xxx is " xxx". The intention is that a single space is used to format doc comments normally while more spaces are used for more format options - extra single space lets you to force a line break, etc. I'm pretty sure I have this behavior documented somewhere but I can't find it...

I guess we can use strip_prefix to remove that single space and make the behavior clearer in the documentation.... Feel free to do the strip_prefix change, as for the documentation - I have something in work already, it's just needs to be split into smaller chunks, cleaned up and merged... If you want to help here - that would be great.

@pacak pacak added the documentation Improvements or additions to documentation label Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants