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
Fixes anchor links in installation instructions #648
Conversation
{#anchor} format that github's Markdown does not understand.
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
CLAs look good, thanks! |
@@ -30,7 +30,7 @@ images are listed in the corresponding installation sections. | |||
If you encounter installation errors, see | |||
[common problems](#common_install_problems) for some solutions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still a couple of these left... can you look for #[a-z_]* and fix them all so we can tick off the files you've touched?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry I missed them, let me do another round of checks then reply back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Note that this only fixes os_setup.md, and any inward reference files (so that there are no broken links). If I fix all files I touched it will quickly expand to all files :-)
@@ -121,13 +121,13 @@ $ source ~/tensorflow/bin/activate.csh # If using csh | |||
(tensorflow)$ # Your prompt should change | |||
|
|||
# Ubuntu/Linux 64-bit, CPU only: | |||
(tensorflow)$ pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.6.0-cp27-none-linux_x86_64.whl | |||
(tensorflow)$ pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you change these to 0.5.0?
the internal and OSS versions have diverged for a few days now. Also, they're different, kept in sync with a bunch of script. You can't copy any content from the third_party version into github, it won't work. You'll have to redo the change (it shoudl be possible to apply the patch to the public version you checked out from github, but no guarantees on that either). |
I apologize. Let me retry this. |
|
||
## Pip Installation {#pip_install} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it wise to simply remove the {#anchor} notation? From what I understand, this syntax is used internally to render the Markdown to HTML with id tags, which is then used on the tensorflow.org website.
If the goal is to have this work on both Github and tensorflow.org, my suggestion is, rather than removing the {#anchor}, replace {#old-anchor} with a {#new-anchor}, such that "#new-anchor" matches the automatically created id inside of Github.
for example, I suggest that this line should become:
## Pip Installation {#pip-installation}
I signed it! 2015-12-29 17:18 GMT-05:00 googlebot notifications@github.com:
|
This commit does two things: 1. Removes all '{#anchor}' syntax from Markdown header lines in the codebase 2. Replaces all links that used those #anchors with links conforming to Github/Tensorflow website auto-generated anchors The work is a continuation on tensorflow#648. This commit does not change the API docs, as those Markdown files are auto-generated. Generated using Python script available here: https://github.com/samjabrahams/tensorflow_util/blob/master/py/change_header_anchor_links.py
This changes cross-page references to outdated {#anchor} links to instead point to the automatically created Github/TensorFlow.org anchors See tensorflow#648
This commit does two things: 1. Removes all '{#anchor}' syntax from Markdown header lines in the codebase 2. Replaces all links that used those #anchors with links conforming to Github/Tensorflow website auto-generated anchors The work is a continuation on tensorflow#648. This commit does not change the API docs, as those Markdown files are auto-generated. Generated using Python script available here: https://github.com/samjabrahams/tensorflow_util/blob/master/py/change_header_anchor_links.py Cross-page links changed by hand using this script to find non-api anchor links: https://github.com/samjabrahams/tensorflow_util/blob/master/py/get_anchor_references.py
This commit does two things: 1. Removes all '{#anchor}' syntax from Markdown header lines in the codebase 2. Replaces all links that used those #anchors with links conforming to Github/Tensorflow website auto-generated anchors The work is a continuation on tensorflow#648. This commit does not change the API docs, as those Markdown files are auto-generated. Generated using Python script available here: https://github.com/samjabrahams/tensorflow_util/blob/master/py/change_header_anchor_links.py Cross-page links changed by hand using this script to find non-api anchor links: https://github.com/samjabrahams/tensorflow_util/blob/master/py/get_anchor_references.py
This commit does two things: 1. Removes all '{#anchor}' syntax from Markdown header lines in the codebase 2. Replaces all links that used those #anchors with links conforming to Github/Tensorflow website auto-generated anchors The work is a continuation on tensorflow#648. This commit does not change the API docs, as those Markdown files are auto-generated. Generated using Python script available here: https://github.com/samjabrahams/tensorflow_util/blob/master/py/change_header_anchor_links.py Cross-page links changed by hand using this script to find non-api anchor links: https://github.com/samjabrahams/tensorflow_util/blob/master/py/get_anchor_references.py
Finally got my commits squashed properly, snagging all of these {#anchors}. See #660. |
Awesome. I didn't know about the -N uniquification. Do we have a case like On Thu, Dec 31, 2015 at 1:55 PM Sam Abrahams notifications@github.com
|
I haven't seen a case where it comes up in the TensorFlow docs- I just know that Github performs that action. Also, I noticed that the code doesn't handle apostrophes or other mid-word non-alphanumeric characters correctly. Whoops! Luckily it only messed up three links, so I'll get that patched in. I believe the change needed to make the python code work is to remove non-alphanumeric/- characters instead of replacing them with a space. |
This commit does two things: 1. Removes all '{#anchor}' syntax from Markdown header lines in the codebase 2. Replaces all links that used those #anchors with links conforming to Github/Tensorflow website auto-generated anchors The work is a continuation on tensorflow#648. This commit does not change the API docs, as those Markdown files are auto-generated. Generated using Python script available here: https://github.com/samjabrahams/tensorflow_util/blob/master/py/change_header_anchor_links.py Cross-page links changed by hand using this script to find non-api anchor links: https://github.com/samjabrahams/tensorflow_util/blob/master/py/get_anchor_references.py
Those three goofed links in #660 have been fixed. Also, I modified the anchor-creating Python function back in the line comments to work properly. Just had to change the first lambda to |
After realizing I missed some details for the GitHub-ification of header anchors, I played around with more edge cases to hone the algorithm. I had to make three small changes to what I had above:
GitHub handles UTF-8 encoding in its header anchors, so make sure that any settings necessary to enable UTF-8 are switched on. I changed the code in the line notes above, but here is the fixed Python code again so going back up to read it isn't necessary. To test out Unicode letters in Python, make sure to explicitly make the string unicode with def create_anchor_from_header(header, existingAnchors=None):
# Strip white space on the left/right and make lower case
out = header.strip().lower()
# Replace groups of white space with hyphens
out = re.sub(ur'\s+', lambda x: "-", out, flags=re.UNICODE)
# Remove non-alphanumeric characters, hyphens, and spaces
out = re.sub(ur'[^\w\- ]+', lambda x: "", out, flags=re.UNICODE)
if existingAnchors:
if out in existingAnchors:
i = 1
while (out + "-" + str(i)) in existingAnchors and i < 100:
i = i + 1
out += "-" + str(i)
return out |
This PR is superceded by #660, I'll close it. |
I'm late to this. Thanks @samjabrahams for taking this and making it much better :-) |
…pstream-zyin-workaround-hip-unloadmodule Adding dockerfile workaround for hip runtime issue
The header anchor links in the docs (inside the directory g3doc) is using a {#anchor} format that github's Markdown does not understand. This PR primarily fixes the anchor text in the installation instructions, which I assume is fairly popular.