Skip to content

Commit

Permalink
Fixing markdown block formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bakks committed Jan 17, 2024
1 parent 722e0d0 commit 4b7319a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ func (this *StyleCodeblocksWriter) Write(p []byte) (n int, err error) {
case STATE_THREE_TICKS:
if char == '\n' {
this.state = STATE_BLOCK_NEWLINE
toWrite.Write([]byte("\n"))
toWrite.WriteByte('\r')
this.blockBuffer = new(bytes.Buffer)
} else {
// append to suffix
Expand Down
6 changes: 3 additions & 3 deletions util/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Foo`

writer.Write([]byte(testStr))

expected := "Hello\n\nconsole.log('Hi');\r\x1b[38;5;231mconsole.log('Hi');\x1b[0m\nNORMAL\nFoo"
expected := "Hello\n\rconsole.log('Hi');\r\x1b[38;5;231mconsole.log('Hi');\x1b[0m\nNORMAL\nFoo"

// assert buffer equals expected
assert.Equal(t, expected, buffer.String())
Expand All @@ -79,7 +79,7 @@ Foo`

writer.Write([]byte(testStr))

expected := "Hello\n\nconsole.log(1);\r\x1b[38;5;148mconsole\x1b[0m\x1b[38;5;231m.\x1b[0m\x1b[38;5;148mlog\x1b[0m\x1b[38;5;231m(\x1b[0m\x1b[38;5;141m1\x1b[0m\x1b[38;5;231m);\x1b[0m\nNORMAL\nFoo"
expected := "Hello\n\rconsole.log(1);\r\x1b[38;5;148mconsole\x1b[0m\x1b[38;5;231m.\x1b[0m\x1b[38;5;148mlog\x1b[0m\x1b[38;5;231m(\x1b[0m\x1b[38;5;141m1\x1b[0m\x1b[38;5;231m);\x1b[0m\nNORMAL\nFoo"

// assert buffer equals expected
assert.Equal(t, expected, buffer.String())
Expand Down Expand Up @@ -127,7 +127,7 @@ Foo`

writer.Write([]byte(testStr))

expected := "Hello\n\n \n console.log(1);\r\x1b[38;5;231m \x1b[0m\x1b[38;5;148mconsole\x1b[0m\x1b[38;5;231m.\x1b[0m\x1b[38;5;148mlog\x1b[0m\x1b[38;5;231m(\x1b[0m\x1b[38;5;141m1\x1b[0m\x1b[38;5;231m);\x1b[0m\n NORMAL\nFoo"
expected := "Hello\n\n \r console.log(1);\r\x1b[38;5;231m \x1b[0m\x1b[38;5;148mconsole\x1b[0m\x1b[38;5;231m.\x1b[0m\x1b[38;5;148mlog\x1b[0m\x1b[38;5;231m(\x1b[0m\x1b[38;5;141m1\x1b[0m\x1b[38;5;231m);\x1b[0m\n NORMAL\nFoo"

// assert buffer equals expected
assert.Equal(t, expected, buffer.String())
Expand Down

0 comments on commit 4b7319a

Please sign in to comment.