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

EXTENSION_NO_INTRA_EMPHASIS does not play well with custom Renderer #518

Closed
tcharding opened this issue Aug 23, 2017 · 2 comments
Closed

Comments

@tcharding
Copy link

We are using a custom renderer and passing it to blackfriday.Markdown with the extension blackfriday.EXTENSION_NO_INTRA_EMPHASIS. Our renderer implements NormalText to strip unexpected line breaks

// NormalText gets a text chunk *after* the markdown syntax was already
// processed and does a final cleanup on things we don't expect here, like
// removing linebreaks on things that are not a paragraph break (auto unwrap).
func (r *ASCIIRenderer) NormalText(out *bytes.Buffer, text []byte) {
	raw := string(text)
	lines := strings.Split(raw, linebreak)
	for _, line := range lines {
		trimmed := strings.Trim(line, " \n\t")
		out.WriteString(trimmed)
		out.WriteString(" ")
	}
}

Text with an internal emphasis (e.g KUBE_EDITOR) is being passed to NormalText with a line break in the middle? This means we cannot remove the line break without either, adding spurious whitespace (i.e KUBE _EDITOR), or missing a space when an expected linebreak was removed.

Do we have the correct expectations for NormalText? Or am I missing something?

thanks

@n10v
Copy link
Collaborator

n10v commented Sep 30, 2017

Sorry, but I can't understand how cobra caused this issue. I think it's fault of blackfriday, not cobra.

@tcharding
Copy link
Author

My sincere apologies for wasting your time. You are clearly correct.

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