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

Added Updated default version to Rustfmt docs config #4644

Merged
merged 1 commit into from
Jan 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
</div>
<script>
const RusfmtTagsUrl = 'https://api.github.com/repos/rust-lang/rustfmt/tags';
const RustfmtLatestUrl = 'https://api.github.com/repos/rust-lang/rustfmt/releases/latest';
const UrlHash = window.location.hash.replace(/^#/, '');
const queryParams = new URLSearchParams(window.location.search);
const searchParam = queryParams.get('search');
Expand All @@ -112,6 +113,16 @@
scrolledOnce: false,
},
asyncComputed: {
async updateVersion() {
let latest;
try {
latest = (await axios.get(RustfmtLatestUrl)).data;
} catch(err) {
console.log(err);
return;
}
this.version = latest.name;
},
async outputHtml() {
if (this.version !== this.oldVersion) {
const ConfigurationMdUrl =
Expand Down