-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: Enabled syntax highlight to a code block #83
Conversation
CI通るように修正します |
b136284
to
c38ddec
Compare
c38ddec
to
7376d26
Compare
conflict直してpushしなおします。 |
7376d26
to
4cf9af3
Compare
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.
@korosuke613
見ました!ご確認よろしくです〜
4cf9af3
to
1930df7
Compare
@ganta |
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.
@korosuke613 見逃しがあったので、いくつかコメントしました〜
1930df7
to
c41f38a
Compare
@@ -20,6 +22,43 @@ class MarktoneRendererHelper { | |||
|
|||
return html; | |||
} | |||
|
|||
static unescapeHTML(html: string): string { |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
bd78320
to
7a4a791
Compare
const escapeTest = /[&<>"']/; | ||
const escapeReplace = /[&<>"']/g; | ||
const replacements: { [key: string]: string } = { | ||
private static escapeSettings: ReplaceSettings = { |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
}, | ||
}; | ||
|
||
private static unescapeSettings: ReplaceSettings = { |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
return target; | ||
} | ||
|
||
static escapeHTML(html: string): string { |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
@ganta https://codeclimate.com/github/ganta/chrome-extension-marktone/pull/83 |
7a4a791
to
0467cb4
Compare
@korosuke613 コード類似の指摘は、大抵のケースにおいて似て非なるものであることが多いです。 今回のケースではhighlight.js側がエスケープ処理の有無に対応していないことを回避しようとしたことが発端ですね。 と言っても、現段階ではわりとどうしようもない感じがするので、 レビューが完了したらこちらでCode Climateの指摘を除外します。 コードのあやしいところを見つけてくれるので、コード類似指摘自体はまだ有効化したままにしておこうと思います。 |
64646f3
to
a708324
Compare
@ganta 根本原因はライブラリ側にあるので、確かに厳しい感じはありますね〜
了解です!修正しました! |
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.
@korosuke613 ちょっとだけコメントしましたのでよろしくです〜
const escapeTest = /((<)|(&)|(>)|(&quat)|('))/; | ||
const escapeReplace = new RegExp(escapeTest, "g"); |
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.
[nits]
ここらへんの変数名は意味が逆になっているのでunescapeTest
、unescapeReplace
というようにしておきましょうか
(もとの命名がよろしくないというのはあるのですが)
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.
あああ確認不足でした...
修正しました!ありがとうございます!
https://github.com/ganta/chrome-extension-marktone/pull/83/files#diff-9eaf230ebb45489bd5b70a3e292c7cc5R27-R28
@@ -20,6 +22,43 @@ class MarktoneRendererHelper { | |||
|
|||
return html; | |||
} | |||
|
|||
static unescapeHTML(html: string): string { | |||
const escapeTest = /((<)|(&)|(>)|(&quat)|('))/; |
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.
[MUST]
いくつかセミコロンが抜けてますね。
&
と;
だけ別にする書き方もできます
const escapeTest = /((<)|(&)|(>)|(&quat)|('))/; | |
const escapeTest = /(&(?:lt|amp|gt|quat|#39);)/; |
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.
テスト不足でした...
確かに&
と;
は共通してましたね。ありがとうございます!
https://github.com/ganta/chrome-extension-marktone/pull/83/files#diff-9eaf230ebb45489bd5b70a3e292c7cc5R27
a708324
to
01fdb72
Compare
@@ -20,6 +22,43 @@ class MarktoneRendererHelper { | |||
|
|||
return html; | |||
} | |||
|
|||
static unescapeHTML(html: string): string { | |||
const unescapeTest = /(&(?:lt|amp|gt|quat|#39);)/; |
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.
@korosuke613
quot
のtypo見逃していました〜
他は大丈夫そうです!
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.
oh...すみません確認不足でした..
修正しました!
https://github.com/ganta/chrome-extension-marktone/pull/83/files#diff-9eaf230ebb45489bd5b70a3e292c7cc5R27
01fdb72
to
7c90b1e
Compare
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.
@korosuke613 Thank you!
closed #82