mirror of
https://github.com/maaslalani/slides.git
synced 2026-01-09 14:28:05 -05:00
Fix #39, allow code blocks without trailing new line to run
This commit is contained in:
@@ -21,7 +21,7 @@ type Result struct {
|
||||
}
|
||||
|
||||
// ?: means non-capture group
|
||||
var re = regexp.MustCompile("(?s)(?:```|~~~)(\\w+)\n(.*)\n(?:```|~~~)\n")
|
||||
var re = regexp.MustCompile("(?s)(?:```|~~~)(\\w+)\n(.*)\n(?:```|~~~)\\s?")
|
||||
|
||||
var (
|
||||
ErrParse = errors.New("Error: could not parse code block")
|
||||
|
||||
@@ -37,6 +37,16 @@ fmt.Println("Hello, world!")
|
||||
},
|
||||
{
|
||||
markdown: `
|
||||
~~~python
|
||||
print("Hello, world!")
|
||||
~~~`,
|
||||
expected: code.Block{
|
||||
Code: `print("Hello, world!")`,
|
||||
Language: "python",
|
||||
},
|
||||
},
|
||||
{
|
||||
markdown: `
|
||||
# Welcome to Slides
|
||||
|
||||
A terminal based presentation tool
|
||||
|
||||
Reference in New Issue
Block a user