Skip to content

Parse rustdocs out of markdown-formatted doc strings #1942

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

Closed
brson opened this issue Mar 7, 2012 · 2 comments
Closed

Parse rustdocs out of markdown-formatted doc strings #1942

brson opened this issue Mar 7, 2012 · 2 comments
Assignees
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@brson
Copy link
Contributor

brson commented Mar 7, 2012

This is an example of a current rustdoc from core:

#[doc(
    desc = "

Convert a string to a float

This function accepts strings such as

* '3.14'
* '+3.14', equivalent to '3.14'
* '-3.14'
* '2.5E10', or equivalently, '2.5e10'
* '2.5E-10'
* '', or, equivalently, '.' (understood as 0)
* '5.'
* '.5', or, equivalently,  '0.5'

Leading and trailing whitespace are ignored.

",
    args(
        num = "A string"
    ),
    return = "

none if the string did not represent a valid number.  Otherwise, some(n) where
n is the floating-point number represented by [num].

")]

All of the extra attribute stuff is noise. Without much difficulty we could parse markdown like:

#[doc = "

Convert a string to a float

This function accepts strings such as

* '3.14'
* '+3.14', equivalent to '3.14'
* '-3.14'
* '2.5E10', or equivalently, '2.5e10'
* '2.5E-10'
* '', or, equivalently, '.' (understood as 0)
* '5.'
* '.5', or, equivalently,  '0.5'

Leading and trailing whitespace are ignored.

Arguments:

* num - A string

Returns:

none if the string did not represent a valid number.  Otherwise, some(n) where
n is the floating-point number represented by [num].

"]
@ghost ghost assigned brson Mar 8, 2012
@catamorphism
Copy link
Contributor

Assigning to you, @brson , since you seem to have fixed most bugs labeled as rustdoc -- feel free to reassign :-)

@brson brson closed this as completed Mar 10, 2012
@brson
Copy link
Contributor Author

brson commented Mar 10, 2012

Done.

celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Kobzol pushed a commit to Kobzol/rust that referenced this issue Dec 30, 2024
bors pushed a commit to rust-lang-ci/rust that referenced this issue Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants