Skip to content

Conversation

@akihiro17
Copy link
Contributor

@akihiro17 akihiro17 commented Jul 18, 2023

https://pkg.go.dev/encoding/json#Encoder.SetEscapeHTML

datadogのクエリがエスケープされてしまうので文字列<をescapeしないようにします。terraform-j2mdの出力結果をそのままhtmlとして使うことないと思うのでterraform-j2mdでエスケープしなくても大丈夫じゃないかと思っていますが、一応オプションで「エスケープしない」を選択できるようにしています。デフォルトは今まで通り「エスケープする」です

json.Encoderは末尾に改行をつけるみたいで微妙に差分が変わっているので、全部go run cmd/terraform-j2md/main.go <test/testdata/include_module/show.json >test/testdata/include_module/expected.mdのようにしてテストデータを変えています。
ref. https://github.com/golang/go/blob/28ca813a1373ff3c8845b0145ce915cca73ff182/src/encoding/json/stream.go#L220

@akihiro17 akihiro17 changed the title Dont escape html characters Don't escape html characters Jul 18, 2023
@akihiro17 akihiro17 requested review from okkez and takaishi July 19, 2023 03:39
Copy link
Collaborator

@takaishi takaishi left a comment

Choose a reason for hiding this comment

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

LGTM

@akihiro17 akihiro17 merged commit b719045 into reproio:master Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants