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

Add the version into all links in the docs if it exists. #4334

Merged
merged 3 commits into from
May 18, 2018

Conversation

samelhusseini
Copy link
Contributor

Adds vN to all links rendered by the markdown if it exists. We also add the vN prefix for all links in the docs sidemenu.

Reason for changes, if you start browsing on makecode.microbit.org/vN you want to stay browsing on that site, rather than switch to latest.

@samelhusseini samelhusseini requested review from pelikhan and mmoskal May 18, 2018 00:28
const relative = href.indexOf('/') == 0;
const target = !relative ? '_blank' : '';
if (relative && d.versionPath) href = `/${d.versionPath}${href}`;
return `<a href="${href}" ${title ? `aria-label="${title}"` : ''} ${target ? `target="${target}"` : ''}>${text}</a>`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these strings escaped already?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment looks good: markedjs/marked#655 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find. I'll use that comment instead and patch in my fix.

Copy link
Member

@pelikhan pelikhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure proper encoding and sanization of links

@samelhusseini
Copy link
Contributor Author

Fixed.

@pelikhan pelikhan merged commit d72df60 into master May 18, 2018
@pelikhan pelikhan deleted the addversionpathintolinks branch May 18, 2018 18:32
@lock
Copy link

lock bot commented Sep 26, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants