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

Preserve comments in YAML/TOML in the Remarshal func #4520

Open
bep opened this issue Mar 20, 2018 · 3 comments
Open

Preserve comments in YAML/TOML in the Remarshal func #4520

bep opened this issue Mar 20, 2018 · 3 comments
Assignees
Milestone

Comments

@bep
Copy link
Member

bep commented Mar 20, 2018

Do some string replacement

"# My comment" => "hugocomment = "My comment" => and back.

Ignore the last step for JSON (which does not support it).

@bep bep added this to the v0.38 milestone Mar 20, 2018
@bep bep self-assigned this Mar 20, 2018
@kaushalmodi
Copy link
Contributor

For JSON, may be use a hack like shown here: https://stackoverflow.com/a/244858/1219634

..
"_hugo_comment": "My comment",
..

@bep bep modified the milestones: v0.38, v0.39 Mar 20, 2018
@bep bep modified the milestones: v0.39, v0.40 Apr 9, 2018
@bep bep modified the milestones: v0.40, v0.41 Apr 20, 2018
@bep bep modified the milestones: v0.41, v0.42 May 4, 2018
@bep bep modified the milestones: v0.42, v0.43 Jun 5, 2018
@bep bep modified the milestones: v0.43, v0.44 Jun 30, 2018
@bep bep modified the milestones: v0.44, v0.45, v0.46 Jul 10, 2018
@bep bep modified the milestones: v0.46, v0.47, v0.48 Aug 3, 2018
@bep bep modified the milestones: v0.48, v0.49 Aug 22, 2018
@bep bep removed this from the v0.49 milestone Sep 13, 2018
@bep bep added this to the v0.116.0 milestone Jun 30, 2023
@bep bep modified the milestones: v0.116.0, v0.117.0 Aug 1, 2023
@bep bep modified the milestones: v0.117.0, v0.118.0 Aug 30, 2023
@bep bep modified the milestones: v0.118.0, v0.119.0 Sep 15, 2023
@bep bep modified the milestones: v0.119.0, v0.120.0 Oct 4, 2023
@bep bep modified the milestones: v0.120.0, v0.121.0 Oct 31, 2023
@bep bep modified the milestones: v0.121.0, v0.122.0 Dec 6, 2023
@bep bep modified the milestones: v0.122.0, v0.123.0, v0.124.0 Jan 27, 2024
@bep bep modified the milestones: v0.124.0, v0.125.0 Mar 4, 2024
@bep bep modified the milestones: v0.125.0, v0.126.0 Apr 23, 2024
@bep bep modified the milestones: v0.126.0, v0.127.0 May 15, 2024
@razonyang
Copy link
Contributor

razonyang commented Jun 4, 2024

I'm interested in this, it would helpful for readers to view important annotation in place. I have a question is that is it possible preseve the comments and display it in-place?

foo:
  bar:
    fizz: buzz # annotation for fizz.

Remarshal to TOML.

[foo.bar]
fizz = "buzz" # annotation for fizz.

@bep bep closed this as completed Jun 4, 2024
@bep bep reopened this Jun 4, 2024
@bep bep modified the milestones: v0.127.0, v0.128.0 Jun 8, 2024
@bep bep modified the milestones: v0.128.0, v0.129.0 Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants