From 589d269ab3e7d2b763bbfc2463bd50b7c7ea7da2 Mon Sep 17 00:00:00 2001 From: iFun Date: Tue, 1 Oct 2019 11:25:11 -0400 Subject: [PATCH 1/4] added solution link --- src/webview/leetCodePreviewProvider.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/webview/leetCodePreviewProvider.ts b/src/webview/leetCodePreviewProvider.ts index d0378ef8..781be38a 100644 --- a/src/webview/leetCodePreviewProvider.ts +++ b/src/webview/leetCodePreviewProvider.ts @@ -73,9 +73,9 @@ class LeetCodePreviewProvider extends LeetCodeWebview { const { title, url, category, difficulty, likes, dislikes, body } = this.description; const head: string = markdownEngine.render(`# [${title}](${url})`); const info: string = markdownEngine.render([ - `| Category | Difficulty | Likes | Dislikes | [Discuss](${url.replace("/description/", "/discuss/?currentPage=1&orderBy=most_votes&query=")}) |`, - `| :------: | :--------: | :---: | :------: | :-----: |`, - `| ${category} | ${difficulty} | ${likes} | ${dislikes} | -- |`, + `| Category | Difficulty | Likes | Dislikes | [Discuss](${url.replace("/description/", "/discuss/?currentPage=1&orderBy=most_votes&query=")}) | [Solution](${url.replace("/description/", "/solution/")}) |`, + `| :------: | :--------: | :---: | :------: | :-----: | :------: |`, + `| ${category} | ${difficulty} | ${likes} | ${dislikes} | -- | -- |`, ].join("\n")); const tags: string = [ `
`, From 825ca177158b02318669b8c5ca3b440bb152c581 Mon Sep 17 00:00:00 2001 From: Sheng Chen Date: Wed, 2 Oct 2019 12:58:22 +0800 Subject: [PATCH 2/4] Move the link position to the bottom of the page --- ACKNOWLEDGEMENTS.md | 4 +++- src/webview/leetCodePreviewProvider.ts | 30 +++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/ACKNOWLEDGEMENTS.md b/ACKNOWLEDGEMENTS.md index 49a975e8..4bc00ba3 100644 --- a/ACKNOWLEDGEMENTS.md +++ b/ACKNOWLEDGEMENTS.md @@ -2,6 +2,7 @@ A big thanks to the following individuals for contributing: +- [@JIEJIAN21](https://github.com/JIEJIAN21) - thanks for logo and icon design - [@TsFreddie](https://github.com/TsFreddie) — [contributions](https://github.com/jdneo/vscode-leetcode/commits?author=TsFreddie) - [@ntt2k](https://github.com/ntt2k) — [contributions](https://github.com/jdneo/vscode-leetcode/commits?author=ntt2k) - [@purocean](https://github.com/purocean) — [contributions](https://github.com/jdneo/vscode-leetcode/commits?author=purocean) @@ -17,4 +18,5 @@ A big thanks to the following individuals for contributing: - [@houtianze](https://github.com/houtianze) — [contributions](https://github.com/jdneo/vscode-leetcode/commits?author=houtianze) - [@magic-akari](https://github.com/magic-akari) - [contributions](https://github.com/jdneo/vscode-leetcode/commits?author=magic-akari) - [@SF-Zhou](https://github.com/SF-Zhou) - [contributions](https://github.com/jdneo/vscode-leetcode/commits?author=SF-Zhou) -- [@JIEJIAN21](https://github.com/JIEJIAN21) - thanks for logo and icon design +- [@fuafa](https://github.com/fuafa) - [contributions](https://github.com/jdneo/vscode-leetcode/commits?author=fuafa) +- [@iFun](https://github.com/iFun) - [contributions](https://github.com/jdneo/vscode-leetcode/commits?author=iFun) diff --git a/src/webview/leetCodePreviewProvider.ts b/src/webview/leetCodePreviewProvider.ts index 781be38a..0bd3aaa6 100644 --- a/src/webview/leetCodePreviewProvider.ts +++ b/src/webview/leetCodePreviewProvider.ts @@ -73,9 +73,9 @@ class LeetCodePreviewProvider extends LeetCodeWebview { const { title, url, category, difficulty, likes, dislikes, body } = this.description; const head: string = markdownEngine.render(`# [${title}](${url})`); const info: string = markdownEngine.render([ - `| Category | Difficulty | Likes | Dislikes | [Discuss](${url.replace("/description/", "/discuss/?currentPage=1&orderBy=most_votes&query=")}) | [Solution](${url.replace("/description/", "/solution/")}) |`, - `| :------: | :--------: | :---: | :------: | :-----: | :------: |`, - `| ${category} | ${difficulty} | ${likes} | ${dislikes} | -- | -- |`, + `| Category | Difficulty | Likes | Dislikes |`, + `| :------: | :--------: | :---: | :------: |`, + `| ${category} | ${difficulty} | ${likes} | ${dislikes} |`, ].join("\n")); const tags: string = [ `
`, @@ -97,6 +97,11 @@ class LeetCodePreviewProvider extends LeetCodeWebview { ), `
`, ].join("\n"); + const links: string = markdownEngine.render([ + `---`, + `- [Discussion](${this.getDiscussionLink(url)})`, + `- [Solution](${this.getSolutionLink(url)})`, + ].join("\n")); return ` @@ -114,6 +119,7 @@ class LeetCodePreviewProvider extends LeetCodeWebview { ${tags} ${companies} ${body} + ${links} ${!this.sideMode ? button.element : ""}