mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-09 17:12:14 +01:00
chore: add markdown table sample & test
This commit is contained in:
@@ -432,6 +432,29 @@ func TestConvertMarkdownHandler(t *testing.T) {
|
||||
outputDir: "/tmp/foo",
|
||||
expectOutputPathsCount: 1,
|
||||
},
|
||||
{
|
||||
ctx: func() *api.MockContext {
|
||||
ctx := &api.MockContext{Context: &api.Context{}}
|
||||
|
||||
ctx.SetDirPath("/tmp/foo")
|
||||
ctx.SetFiles(map[string]string{
|
||||
"index.html": "/tests/test/testdata/chromium/markdown/sample3/index.html",
|
||||
"markdown1.md": "/tests/test/testdata/chromium/markdown/sample3/markdown.md",
|
||||
})
|
||||
|
||||
return ctx
|
||||
}(),
|
||||
api: func() API {
|
||||
chromiumAPI := struct{ ProtoAPI }{}
|
||||
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
return chromiumAPI
|
||||
}(),
|
||||
outputDir: "/tmp/foo",
|
||||
expectOutputPathsCount: 1,
|
||||
},
|
||||
} {
|
||||
func() {
|
||||
if tc.outputDir != "" {
|
||||
|
||||
18
test/testdata/chromium/markdown/sample3/index.html
vendored
Normal file
18
test/testdata/chromium/markdown/sample3/index.html
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Gutenberg</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Table in markdown</h1>
|
||||
|
||||
<h2>toHTML</h2>
|
||||
{{ toHTML "markdown.md" }}
|
||||
|
||||
<h2>Actual HTML</h2>
|
||||
<textarea readonly="readonly" cols="100" rows="50">
|
||||
{{ toHTML "markdown.md" }}
|
||||
</textarea>
|
||||
</body>
|
||||
</html>
|
||||
5
test/testdata/chromium/markdown/sample3/markdown.md
vendored
Normal file
5
test/testdata/chromium/markdown/sample3/markdown.md
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
| Tables | Are | Cool |
|
||||
|----------|:-------------:|------:|
|
||||
| col 1 is | left-aligned | $1600 |
|
||||
| col 2 is | centered | $12 |
|
||||
| col 3 is | right-aligned | $1 |
|
||||
Reference in New Issue
Block a user