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

Leading sharp in generated readme's example code #38

Open
msrd0 opened this issue Oct 14, 2019 · 8 comments · May be fixed by #67
Open

Leading sharp in generated readme's example code #38

msrd0 opened this issue Oct 14, 2019 · 8 comments · May be fixed by #67

Comments

@msrd0
Copy link
Contributor

msrd0 commented Oct 14, 2019

In the example code here there is a leading sharp in the first line that shouldn't be there. In the generated rustdoc it's not present.

Wrong Behaviour

The sharp followed by an empty line is included. Screenshot from the generated README:

image

Expected Behaviour

The sharp, along with the rest of the line, should not be included. Screenshot from the rustdoc:

image

Setup

Issue happens on both ArchLinux and AlpineLinux, Rust/Cargo 1.38.0, Cargo-Readme 3.1.2

@Empty2k12

This comment has been minimized.

@msrd0
Copy link
Contributor Author

msrd0 commented Oct 14, 2019

Well, the sharp is comming from {{readme}} section of my template. It's probably because lines starting with a sharp and followed by a whitespace are supposed to be ignored in the code examples in rustdoc, but is falsely not excluded in this case in cargo readme. So unfortunately, @Empty2k12's comment is not helpful in my case.

@Empty2k12
Copy link

@msrd0
Copy link
Contributor Author

msrd0 commented Oct 14, 2019

@Empty2k12 this line is not included in the rustdoc so I'm assuming it also shouldn't be in cargo readme

@Empty2k12
Copy link

@msrd0 I'm not sure if this library is using rustdoc internally, so you could fix the problem yourself be removing that line. I don't understand why it's there anyways.

@msrd0
Copy link
Contributor Author

msrd0 commented Oct 14, 2019

Well, it's there because you'd usually write an empty line between your imports and the actual code. And this library claims to read docstrings, so I believe this is an issue. Removing that line is obviously a workaround.

@Empty2k12
Copy link

Empty2k12 commented Oct 14, 2019

This library is reading docstrings, but I cannot find any instance where it claims it's doing the same as cargodoc. I would even go as far as saying that a line consisting only of # without a space or text does not qualify as a comment. Therefore you might want to think about filing this as a bug in cargodoc. What's preventing you from having the line be black instead of a blank comment?

@livioribeiro
Copy link
Collaborator

cargo-reame does not use cargodoc, it uses its own parser.

I will take a look at it, as soon as I can

msrd0 added a commit to msrd0/cargo-readme that referenced this issue Apr 19, 2021
msrd0 added a commit to msrd0/cargo-readme that referenced this issue Apr 19, 2021
@msrd0 msrd0 linked a pull request Apr 19, 2021 that will close this issue
msrd0 added a commit to msrd0/cargo-readme that referenced this issue Apr 19, 2021
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.

3 participants