diff --git a/src/components/Post.vue b/src/components/Post.vue index 72a6904..ed10c17 100644 --- a/src/components/Post.vue +++ b/src/components/Post.vue @@ -586,7 +586,8 @@ export default class PostComponent extends Vue { line-height: 1.5; padding: $block-inner-padding; - :deep(pre) { + :deep(pre), + :deep(code) { overflow-x: scroll; } diff --git a/src/utils/markdown.ts b/src/utils/markdown.ts index 1c13870..d557e4b 100644 --- a/src/utils/markdown.ts +++ b/src/utils/markdown.ts @@ -10,7 +10,7 @@ const markdown = new MarkdownIt({ linkify: true, breaks: true }) // Minimal renderer const markdownLite = new MarkdownIt({ linkify: true, breaks: true }) - .disable(["backticks", "emphasis", "strikethrough", "image"]) + .disable(["emphasis", "strikethrough", "image"]) .use( MarkdownItLinkAttrs, { attrs: { target: "_blank", rel: "noopener" } }, diff --git a/tests/unit/markdown.spec.ts b/tests/unit/markdown.spec.ts index 0f1037f..26434ba 100644 --- a/tests/unit/markdown.spec.ts +++ b/tests/unit/markdown.spec.ts @@ -3,8 +3,8 @@ import { renderMarkdownLite } from "@/utils/markdown" describe("Render markdown", () => { it("Render markdown lite", () => { - const text = "test **bold** ~~strike~~ with `code` and https://example.com\nand a new line" + const text = "test **bold** ~~strike~~ with `code`, html and https://example.com\nand a new line" const html = renderMarkdownLite(text) - expect(html).to.equal('test **bold** ~~strike~~ with `code` and https://example.com
\nand a new line') + expect(html).to.equal('test **bold** ~~strike~~ with code, <span>html</span> and https://example.com
\nand a new line') }) })