Closed EricTendian closed 7 years ago
@EricTendian you are a champion! I just spotted this today and was going to start going through and fixing the links but you beat me to it!! 😃 Thank you so much!
Oh snap looks like each pages link to the next page is bust too - I'll try pick that up tomorrow 👍
Thanks! And yeah, good catch. What I did for converting the README links is to convert the markdown file to HTML using pandoc which automatically URL-encodes spaces, then converted it back to markdown as a separate document. That was done with the following two commands:
pandoc README.md -o README.html
pandoc README.html -o README2.md --wrap=none # so that it closely matches original markdown
From there I just copy-pasted the section of links from the pandoc-generated markdown file to the original one, to preserve any special formatting used by gitbook or something else. Perhaps this method can be followed to make those individual pages easier to fix (such as writing a script to do it).
Originally I was going to do this all with regex but found it a lot more complicated/difficult. In case you're curious as to which markdown implementations support spaces in the links: https://johnmacfarlane.net/babelmark2/
I ended up using regex to get all the others with some manual intervention - using this expression - \ (?=[^(]*\))
- which will match on spaces in brackets
Thanks again for your help
Right now the book cannot be viewed in GitHub from README files due to the filenames having spaces and not being URL-encoded, causing GitHub Markdown to render it as something like this:
This PR addresses the problem by properly URL-encoding the links in each of the various README files, including for each translation. In the process of doing the encoding I noticed the Chinese version had level-specific READMEs with different wording than the overall README, so particular headings may have been overwritten with the wording used at zh/README.md.