Allow code blocks in posts
This commit is contained in:
parent
3a33d057c0
commit
44e2fb1624
3 changed files with 5 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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" } },
|
||||
|
|
|
@ -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`, <span>html</span> and https://example.com\nand a new line"
|
||||
const html = renderMarkdownLite(text)
|
||||
expect(html).to.equal('test **bold** ~~strike~~ with `code` and <a href="https://example.com" target="_blank" rel="noopener">https://example.com</a><br>\nand a new line')
|
||||
expect(html).to.equal('test **bold** ~~strike~~ with <code>code</code>, <span>html</span> and <a href="https://example.com" target="_blank" rel="noopener">https://example.com</a><br>\nand a new line')
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue