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

parse_docs doesn't handle block doc comments properly #341

Closed
gustavo-shigueo opened this issue Jul 25, 2024 · 0 comments · Fixed by #342
Closed

parse_docs doesn't handle block doc comments properly #341

gustavo-shigueo opened this issue Jul 25, 2024 · 0 comments · Fixed by #342

Comments

@gustavo-shigueo
Copy link
Collaborator

gustavo-shigueo commented Jul 25, 2024

The way we generate the doc string is:

format!("/**\n{}\n */\n", lines.join("\n")),

lines in the snippet represents a Vec<String>, where each item is the content of a single #[doc = "..."] attribute.

This works great with /// comments, as the compiler converts each of these to its own #[doc = "..."] attribute, where ... is replace with the contents of the comment.

However, a /***/ comment is replaced with a single #[doc = "..."] attribute, where ... is replaced with every single character between the second and third * characters, including any leading or trailing \n.

So

/**
 * Scan progress
 */

is replaced with #[doc = "\n * Scan progress\n "]. This leading \n, combined with our default \n + "* " before the #[doc] contents, causes the weird blank line

Originally posted by @gustavo-shigueo in #316 (comment)

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

Successfully merging a pull request may close this issue.

1 participant