Skip to content

fix more tests for markup/markdown/katex tests #14

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

Conversation

wxiaoguang
Copy link

  • Add missing os.Exit(m.Run()) to markup/html_test.go and fix the test in TestRender_emoji
  • Fix a overflow bug in markup/markdown/meta.go
  • Fix the string vs bytes comparison in markup/markdown/meta_test.go
  • Remove unnecessary util.Dedent, YAML can accept global indention.

@@ -88,7 +88,9 @@ func ExtractMetadataBytes(contents []byte, out interface{}) ([]byte, error) {
line := contents[start:end]
if isYAMLSeparator(line) {
front = contents[frontMatterStart:start]
body = contents[end+1:]
if end+1 < len(contents) {
Copy link
Owner

Choose a reason for hiding this comment

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

This isn't actually necessary.

End is guaranteed to be at most the last character of the slice and slice[len(slice):] never overflows

Copy link
Author

Choose a reason for hiding this comment

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

End is guaranteed to be at most the last character of the slice and slice[len(slice):] never overflows

Yup, however:

suppose len(contents) == 1, end=len(contents)=1 (line 83), then contents[end+1:] is contents[2:], which causes out-of-bound error.

@zeripath zeripath merged commit 99e9d30 into zeripath:small-additional-fix-to-katex Oct 5, 2022
@wxiaoguang wxiaoguang deleted the small-additional-fix-to-katex branch October 5, 2022 10:31
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.

2 participants