-
Notifications
You must be signed in to change notification settings - Fork 62
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
Update markdownfmt to use blackfriday v2 #40
base: main
Are you sure you want to change the base?
Conversation
There is no implementation for the interface yet and the code does not compile.
return blackfriday.GoToNext | ||
} | ||
|
||
func (_ *markdownRenderer) RenderHeader(w io.Writer, ast *blackfriday.Node) {} |
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.
golint: receiver name should not be an underscore, omit the name if it is unused
} | ||
|
||
func (_ *markdownRenderer) RenderHeader(w io.Writer, ast *blackfriday.Node) {} | ||
func (_ *markdownRenderer) RenderFooter(w io.Writer, ast *blackfriday.Node) {} |
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.
golint: receiver name should not be an underscore, omit the name if it is unused
out.WriteByte('\n') | ||
} | ||
func (_ *markdownRenderer) TitleBlock(out *bytes.Buffer, text []byte) { | ||
func (_ *markdownRenderer) BlockHtml(w io.Writer, text []byte) { |
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.
golint: receiver name should not be an underscore, omit the name if it is unused
out.WriteByte('\n') | ||
} | ||
func (_ *markdownRenderer) TitleBlock(out *bytes.Buffer, text []byte) { | ||
func (_ *markdownRenderer) BlockHtml(w io.Writer, text []byte) { |
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.
golint: method BlockHtml should be BlockHTML
w.Write([]byte{'\n'}) | ||
} | ||
return blackfriday.GoToNext | ||
} else { |
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.
golint: if block ends with a return statement, so drop this else and outdent its block
func (_ *markdownRenderer) HRule(out *bytes.Buffer) { | ||
doubleSpace(out) | ||
out.WriteString("---\n") | ||
func (_ *markdownRenderer) HRule(w io.Writer) { |
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.
golint: receiver name should not be an underscore, omit the name if it is unused
} | ||
} | ||
func (_ *markdownRenderer) Emphasis(out *bytes.Buffer, text []byte) { | ||
if len(text) == 0 { | ||
func (_ *markdownRenderer) Image(w io.Writer, link []byte, title []byte, entering bool) { |
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.
golint: receiver name should not be an underscore, omit the name if it is unused
markdown/main.go
Outdated
@@ -504,3 +577,45 @@ func readSource(filename string, src []byte) ([]byte, error) { | |||
} | |||
return ioutil.ReadFile(filename) | |||
} | |||
|
|||
type Buffer struct { |
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.
golint: exported type Buffer should have comment or be unexported
markdown/prefixwriter.go
Outdated
"io" | ||
) | ||
|
||
type prefixWriter struct { |
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.
unused: type prefixWriter is unused (U1000)
markdown/prefixwriter.go
Outdated
} | ||
|
||
// newPrefixWriter creates a new prefix writer that prefixes every line with a prefix. | ||
func newPrefixWriter(w io.Writer, prefix []byte) io.Writer { |
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.
unused: func newPrefixWriter is unused (U1000)
e34db2a
to
61ba6ee
Compare
This passes the original tests for markdownfmt so it should produce the same output as the original markdownfmt.
61ba6ee
to
86b94ed
Compare
Thank you for sending this @jsternberg. I did not forget about this, but it will likely take me a bit of time before I can get to reviewing and merging this. I hope that's okay. A part of the complication for me is that I'll likely want to sync the upgrade to blackfriday v2 for my other package The reason for that is because I use both of them in frontend code, and having one import blackfriday v1 while the other v2 would mean my frontend code size would increase. An alternative I will consider is to have two versions of |
👍 for anyone who needs the library form for their own code like I do, they can just use my fork. |
Fixes #39.