Milkdown / milkdown

🍼 Plugin driven WYSIWYG markdown editor framework.
https://milkdown.dev
MIT License
8.94k stars 405 forks source link

[Bug] commonmark: The last typed * doesn't bold the input, stays italicized #1007

Closed dev-guy closed 1 year ago

dev-guy commented 1 year ago

Initial checklist

Affected packages and versions

commonmark

Link to runnable example

https://stackblitz.com/edit/sveltejs-kit-template-default-z9sbgm?file=src%2Froutes%2FMilkdown.svelte

Steps to reproduce

SvelteKit running on Stackblitz

Go to the above URL. When you see the text "Ready," clear the editor and type: **foo**

See also https://discord.com/channels/870181036041060352/1112047452074279062

Expected behavior

foo is displayed in bold font

Actual behavior

foo is displayed in italic font

Runtime

Chrome

OS

Other (please specify in steps to reproduce)

Build and bundle tools

Vite

s524797336 commented 1 year ago
<script setup lang="ts">
        import { Editor, rootCtx, defaultValueCtx, remarkStringifyOptionsCtx } from "@milkdown/core";
        import { commonmark } from "@milkdown/preset-commonmark";

    export let content;

        function editor(dom) {
          Editor.make()
            .config(ctx => {
                       ctx.set(remarkStringifyOptionsCtx, { emphasis: '*' })
              ctx.set(rootCtx, dom);
              ctx.set(defaultValueCtx, content);
            })
            .use(commonmark)
            .create();
        }
</script>

<div use:editor />

Try this one

dev-guy commented 1 year ago

Thanks!