Skip to content

GitHub's markdown doesn't understand commented out examples in tutorial #1514

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 Jan 14, 2012 · 7 comments
Closed

GitHub's markdown doesn't understand commented out examples in tutorial #1514

brson opened this issue Jan 14, 2012 · 7 comments
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup.

Comments

@brson
Copy link
Contributor

brson commented Jan 14, 2012

See: https://github.com/mozilla/rust/blob/master/doc/tutorial/syntax.md

There are code examples prefixed with # that don't appear in the website version. We should probably try to make our markdown displays correctly on github.

@marijnh
Copy link
Contributor

marijnh commented Jan 14, 2012

These are not commented out examples, but extra code used to make the examples runnable (which is important for keeping the tutorial in sync with the language). There is no markdown mechanism I know of that would allow us to do this in a portable manner. I'm not too concerned about the tutorial looking good on github, personally.

@brson
Copy link
Contributor Author

brson commented Jan 14, 2012

That's pretty cool. Is there a mechanism set up to run these as part of the build? If not, what would it entail?

@brson
Copy link
Contributor Author

brson commented Jan 14, 2012

I wonder if any of the extensions graydon's been playing with (pandoc, etc) has a way to deal with comments.

@marijnh
Copy link
Contributor

marijnh commented Jan 14, 2012

They are not run as part of the build (and there are in fact two errors currently due to float::consts::pi not working). You do

cd doc/tutorial
RUSTC=/path/to/rustc bash test.sh

to get a list of failing fragments.

@nikomatsakis
Copy link
Contributor

Neat.

@bstrie
Copy link
Contributor

bstrie commented Jan 14, 2012

I was the one who brought up this issue, because I couldn't understand the purpose of the leading hashes in the following code fragment:

# fn the_stars_align() -> bool { false }
# fn something_else() -> bool { true }
let x = if the_stars_align() { 4 }
        else if something_else() { 3 }
        else { 0 };

"Are those syntax extensions? Attributes? Some sort of alternative commenting style?" Not being aware that the tutorial even existed on rust-lang.org, GitHub seemed the place to turn for the "official" tutorial. I don't know if I'll be the last person to make that assumption.

Would it be possible for the sources to contain a comment line at the top of each, something like:

# For the canonical version of the tutorial, see: http://www.rust-lang.org/doc/tutorial/

It's not really a big deal, but the syntax highlighting is very nice to have. :)

@graydon
Copy link
Contributor

graydon commented Mar 22, 2012

Think I'm going to close this; adding special comment-support to the format just so that someone viewing the .md source gets redirected to the canonical home of the built docs seems like overkill. Reopen if you disagree vehemently.

@graydon graydon closed this as completed Mar 22, 2012
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
* Deserialize property IDs and rebuild them for output.

* Convert property functions into methods

* Put tests into tests module

* Refactor format check into function

* Remove redundant check

* Import `super` in `tests` module

* Avoid `Option<T>` and use `missing_definition` for `class`

* Fix `clippy` warnings

* Fix format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup.
Projects
None yet
Development

No branches or pull requests

5 participants