Have you heard of Wysimark? It's a WYSIWYG Markdown Editor that I'm trying to add to my webpage using plain JavaScript and the <script>
tag.
I installed it by running pnpm add @wysimark/standalone
Oddly enough, the documentation doesn't seem to provide instructions on how to add the editor using the script
tag, even though it claims to support "Plain JS" (or maybe there's something else missing?)
This is what I have tried:
index.html
<html>
<body>
<div id="editor-container"></div>
<script defer type=module src='index.js'></script>
</body>
</html>
index.js
import { createWysimark } from "@wysimark/standalone"
const container = document.getElementById("editor-container")
const wysimark = createWysimark(container, {
initialMarkdown: "# Hello World",
})
But unfortunately, an error occurs:
Uncaught SyntaxError: The requested module '/cmwysiwig/node_modules/@wysimark/standalone/.dist/browser/index.cjs.js' does not provide an export named 'createWysimark' (at index.js:1:10)
What am I doing wrong here?