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

Formatting creates 'white noise' in some cases #85

Open
matej-g opened this issue Dec 22, 2021 · 2 comments
Open

Formatting creates 'white noise' in some cases #85

matej-g opened this issue Dec 22, 2021 · 2 comments

Comments

@matej-g
Copy link

matej-g commented Dec 22, 2021

I have noticed this in the Thanos repository, take a look at this file's diff for example (the old version is formatted with mdox, the new version removes extra white noise based on an additional script):
https://github.com/thanos-io/thanos/pull/4662/files#diff-59764a4da653d4464eac20465390033ab8abbd8b54688979727065cb389e848d

mdox fmt seem to actually add white spaces where they are not necessary, such as some end of lines. Is this an issue or is this something that is dictated by the GFM or other convention?

@saswatamcode
Copy link
Collaborator

Seems like the whitespaces are in code blocks. This might be due to how we process the command output here.

I tried to replicate this with the code below and this output also has the same whitespaces as in docs/components/compact.md in Thanos,

package main

import (
	"bytes"
	"os"
	"os/exec"
)

func main() {
	b := bytes.Buffer{}

	c := exec.Command("thanos", "compact", "--help")
	c.Stdout = &b
	c.Stderr = &b
	c.Run()

	f, _ := os.OpenFile("output.md", os.O_RDWR|os.O_CREATE, 0755)
	f.Write(b.Bytes())

}

This possibly isn't due to markdown processing or GFM spec, but how we handle command output. Need to look into this more. 🤔

@matej-g
Copy link
Author

matej-g commented Feb 22, 2022

Just FYI, noticed today this happens in code blocks with lines, which are 'overflowing' into the parameter description column. See this screenshot from compact.md as an example:

image

Compare line 305 with other lines, where the parameter name is too long. This causes the description to be moved to the next line and there are 2 extra spaces added at the end of the line.

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

No branches or pull requests

2 participants