Ionaru / easy-markdown-editor

EasyMDE: A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking.
https://stackblitz.com/edit/easymde
MIT License
2.31k stars 308 forks source link

Support Marked 9.0 #561

Closed ilianiv closed 1 month ago

ilianiv commented 10 months ago

Describe the bug An error occurs when used with marked >=8.0

Error: node_modules/easymde/types/easymde.d.ts:103:32 - error TS2694: Namespace '"marked".marked' has no exported member 'MarkedOptions'.

103         markedOptions?: marked.MarkedOptions;
Ionaru commented 9 months ago

That's odd, they didn't mention any type changes in their changelog... https://github.com/markedjs/marked/releases/tag/v9.0.0

Ionaru commented 9 months ago

I'll try and find out what changed.

Viktor-Ivliev commented 5 months ago

Version 11.2.0 has already been released and this problem has not been solved. You need to replace https://github.com/Ionaru/easy-markdown-editor/blob/master/types/easymde.d.ts import { marked } from 'marked'; -> import { marke, MarkedOptions } from 'marked';

https://github.com/Ionaru/easy-markdown-editor/blob/master/types/easymde.d.ts#L104 markedOptions?: MarkedOptions;

or freeze at the maximum supported version

P.S:// as well as there were changed ways of adding rendering, but also post-processing options were added

Viktor-Ivliev commented 5 months ago

It's not broken in version 9, it's been broken since version 6.

RLain commented 1 month ago

Also getting the same issue:

Error: node_modules/easymde/types/easymde.d.ts:103:32 - error TS2694: Namespace '"redacted/node_modules/marked/lib/marked".marked' has no exported member 'MarkedOptions'.

103         markedOptions?: marked.MarkedOptions;
                                   ~~~~~~~~~~~~~

Also compiles with this change:

import { marked, MarkedOptions } from 'marked';
...etc
    interface RenderingOptions {
        codeSyntaxHighlighting?: boolean;
        hljs?: any;
        markedOptions?: MarkedOptions;
        sanitizerFunction?: (html: string) => string;
        singleLineBreaks?: boolean;
    }
Viktor-Ivliev commented 1 month ago

@Ionaru ping

Ionaru commented 1 month ago

or freeze at the maximum supported version

The marked dependency is already set to ^4.1.0, which means any version after that is unsupported. If there's a need to change the settings or renderer, I suggest matching the version.

image


I have tried to upgrade the version of marked, but ran into issues with modern JS syntax that the build system (Gulp, or a plugin) doesn't understand. Specifically a syntax error for a # marking a private method.

[12:43:56] SyntaxError: Unexpected token (2298:8) while parsing C:\Users\Jeroen\Projects\easy-markdown-editor\node_modules\marked\lib\marked.umd.js while parsing file: C:\Users\Jeroen\Projects\easy-markdown-editor\node_modules\marked\lib\marked.umd.js
    at DestroyableTransform.end [as _flush] (C:\Users\Jeroen\Projects\easy-markdown-editor\node_modules\insert-module-globals\index.js:114:21)
    at DestroyableTransform.prefinish (C:\Users\Jeroen\Projects\easy-markdown-editor\node_modules\readable-stream\lib\_stream_transform.js:138:10)
    at DestroyableTransform.emit (node:events:514:28)
    at DestroyableTransform.emit (node:domain:551:15)
    at prefinish (C:\Users\Jeroen\Projects\easy-markdown-editor\node_modules\readable-stream\lib\_stream_writable.js:619:14)
    at finishMaybe (C:\Users\Jeroen\Projects\easy-markdown-editor\node_modules\readable-stream\lib\_stream_writable.js:627:5)
    at endWritable (C:\Users\Jeroen\Projects\easy-markdown-editor\node_modules\readable-stream\lib\_stream_writable.js:638:3)
    at Writable.end (C:\Users\Jeroen\Projects\easy-markdown-editor\node_modules\readable-stream\lib\_stream_writable.js:594:41)
    at DestroyableTransform.onend (C:\Users\Jeroen\Projects\easy-markdown-editor\node_modules\readable-stream\lib\_stream_readable.js:577:10)
    at Object.onceWrapper (node:events:628:28)

image


Because replacing the build system is not something easily done, and the supported version of marked is already set to ^4.1.0, I'm going to close this as 'not planned' and add a requirement to https://github.com/Ionaru/easy-markdown-editor/issues/447.