Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: this.renderer.space is not a function #3630

Open
xujz520 opened this issue Mar 3, 2025 · 1 comment
Open

Uncaught TypeError: this.renderer.space is not a function #3630

xujz520 opened this issue Mar 3, 2025 · 1 comment
Labels

Comments

@xujz520
Copy link

xujz520 commented Mar 3, 2025

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/marked-highlight/lib/index.umd.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/highlight.min.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/default.min.css">
</head>

<body>
    <div id="content" class="markdown-body"></div>
    <script>
        const md = `
# h1

\`\`\`js
console.log(123)
\`\`\`
`
        document.getElementById('content').innerHTML = marked.parse(md, markedHighlight.markedHighlight({
            emptyLangClass: 'hljs',
            langPrefix: 'hljs language-',
            highlight(code, lang, info) {
                console.log(code, lang, info)
                const language = hljs.getLanguage(lang) ? lang : 'plaintext';
                return hljs.highlight(code, { language }).value;
                return code
            }
        }));
    </script>
</body>

</html>

Image

@UziTech
Copy link
Member

UziTech commented Mar 4, 2025

markedHighlight shouldn't be passed in to marked.parse. You should pass it to marked.use like the directions say.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants