diff --git a/packages/zmarkdown/__tests__/__snapshots__/regressions.test.js.snap b/packages/zmarkdown/__tests__/__snapshots__/regressions.test.js.snap index 64fd3a39..b5e56e67 100644 --- a/packages/zmarkdown/__tests__/__snapshots__/regressions.test.js.snap +++ b/packages/zmarkdown/__tests__/__snapshots__/regressions.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Regression tests HTML endpoint #188 It does not crash on unsupported languages fenced code blocks 1`] = ` -"
console.error(\\"foo\\", true)
console.error(\\"foo\\", true)
diff --git a/packages/zmarkdown/__tests__/__snapshots__/server.test.js.snap b/packages/zmarkdown/__tests__/__snapshots__/server.test.js.snap
index ffa18ff3..88731e7e 100644
--- a/packages/zmarkdown/__tests__/__snapshots__/server.test.js.snap
+++ b/packages/zmarkdown/__tests__/__snapshots__/server.test.js.snap
@@ -1,11 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`HTML endpoint accepts POSTed markdown 1`] = `"foo
"`;
-
-exports[`HTML endpoint can enforce shifting level 1`] = `
-"I have seen a dolphin
-On a camera. What is happening with animals these days?\\"
"
-`;
+exports[`HTML endpoint accepts POSTed markdown 1`] = `"foo
"`;
exports[`HTML endpoint correctly renders manifest 1`] = `
Object {
@@ -25,9 +20,14 @@ Object {
}
`;
+exports[`HTML endpoint enforce level shifting by default 1`] = `
+"I have seen a dolphin
+On a camera. What is happening with animals these days?\\"
"
+`;
+
exports[`HTML endpoint produces statistics when configured 1`] = `
"7 chars
-13 chars here
+13 chars here
"
diff --git a/packages/zmarkdown/__tests__/server.test.js b/packages/zmarkdown/__tests__/server.test.js
index 574c6ab0..67ab0c21 100644
--- a/packages/zmarkdown/__tests__/server.test.js
+++ b/packages/zmarkdown/__tests__/server.test.js
@@ -189,14 +189,14 @@ describe('HTML endpoint', () => {
expect(metadata.hasQuizz).toBe(true)
})
- it('can enforce shifting level', async () => {
+ it('enforce level shifting by default', async () => {
const text = dedent(`
# I have seen a dolphin
On a camera. What is happening with animals these days?"
`)
- const response = await a.post(html, {md: text, opts: {heading_shift: 1, enforce_shift: true}})
+ const response = await a.post(html, {md: text, opts: {heading_shift: 1}})
expect(response.status).toBe(200)
const [content] = response.data
diff --git a/packages/zmarkdown/server/factories/controller-factory.js b/packages/zmarkdown/server/factories/controller-factory.js
index 659f38b1..20980c97 100644
--- a/packages/zmarkdown/server/factories/controller-factory.js
+++ b/packages/zmarkdown/server/factories/controller-factory.js
@@ -30,7 +30,7 @@ module.exports = (givenProc, template) => (req, res, next) => {
localOptions.ic_shift = localOptions.depth
}
- const mergedOptions = Object.assign({ enforce_shift: true }, options, localOptions)
+ const mergedOptions = Object.assign({}, options, localOptions)
const processor = processorFactory(givenProc, mergedOptions)
return processor(text)
diff --git a/packages/zmarkdown/server/factories/processor-factory.js b/packages/zmarkdown/server/factories/processor-factory.js
index 44f4cdd7..fc5deb31 100644
--- a/packages/zmarkdown/server/factories/processor-factory.js
+++ b/packages/zmarkdown/server/factories/processor-factory.js
@@ -19,12 +19,10 @@ module.exports = (processor, opts = {}) => {
}
if (processor === 'html') {
- if (!opts.enforce_shift) opts.heading_shift = 2
opts.disable_images_download = true
}
if (processor === 'latex') {
- if (!opts.enforce_shift) opts.heading_shift = 0
opts.disable_ping = true
opts.disable_jsfiddle = true
} else {
@@ -32,7 +30,6 @@ module.exports = (processor, opts = {}) => {
}
if (processor === 'epub') {
- if (!opts.enforce_shift) opts.heading_shift = 2
opts.disable_ping = true
opts.disable_jsfiddle = true
opts.inline = false