-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
IE 11 support :) #1585
Comments
It seems to work just fine for me in IE 11 I created this little test and opened it in ie11 and it seems to work just fine. <!DOCTYPE html>
<html>
<head>
<title>test</title>
</head>
<body>
<textarea id="markdown"></textarea>
<br />
<button id="button" type="button">Submit</button>
<br />
<div id="html"></div>
<script src="https://cdn.jsdelivr.net/gh/markedjs/marked/lib/marked.js"></script>
<script>
var button = document.getElementById("button");
var html = document.getElementById("html");
var markdown = document.getElementById("markdown");
button.addEventListener("click", function () {
html.innerHTML = marked(markdown.value);
});
</script>
</body>
</html> Also our demo works fine in ie11 https://marked.js.org/demo/ Can you give us an error message? |
Thanks. I think the issue is within the |
Are you saying webpack is not able to process Webpack should be pulling from |
Nope :) What I'm saying is that we have configured Maybe this is my question. Why is the object shorthand transpiled in the |
ie11 doesn't support esm so there should be no reason to transpile it to work with ie11. Most likely webpack is pulling code from
Seems like your transpiler should change it to work with your supported browsers in this transpile step. |
The core issue is a breaking change was made to the package without a server major release, so consumers who have successfully used the code in the past are suddenly impacted. Would you consider publishing a 0.8.1 (or 0.9.0) which reinstates the previous release and re-publishing 0.8.0 as 1.0.0? |
Practically, if you're using browserify+babel(ify) (and possibly other tools): Where with 0.7 you'd use: const md = require('marked');
// or
import md from 'marked'; If you need IE 11 support, with 0.8 this now needs to be: const md = require('marked/lib/marked');
// or
import md from 'marked/lib/marked'; |
Ok, now I also see that the |
@UziTech @frontendphil a solution could be to have package.json's That is, if this needs a solution. I'm not very up to date with the current state of transpiling. |
We usually have this in our rollup configs: {
output: [
{
file: 'lib/marked.cjs.js',
format: 'cjs',
compact: true,
},
{
file: 'lib/marked.esm.js',
format: 'esm',
compact: true,
},
],
} You can let your 'main' point to |
Because marked can be a client side library without node by using <script src="https://cdn.jsdelivr.net/gh/markedjs/marked/lib/marked.js"></script> or import marked from 'https://cdn.jsdelivr.net/gh/markedjs/marked/lib/marked.esm.js';
see discussion #1571 (comment) Also benchmark testing showed using es6 in |
Alright, I would just not assume that I need to explicitly import from the |
That's only one pull request away! 🙂 |
I have observed the same behavior, https://material-ui.com/ crashes in IE 11 since the upgrade of marked from v0.7.0 to v0.8.0 mui/material-ui#18834. |
Given this comment:
It seems that the build is configured as follow:
I would propose to add a CJS version of the package and to link it: package.json {
"name": "marked",
"description": "A markdown parser built for speed",
"author": "Christopher Jeffrey",
"version": "0.8.0",
- "main": "./src/marked.js",
+ "main": "./lib/marked.cjs.js",
"bin": "./bin/marked",
"man": "./man/marked.1", |
I have the same issue, upgrading from 0.7.0 to 0.8.0 causes a failure for my angular 8 site in IE11 |
@xygon the work around is to use |
I'm just going to leave this here: and |
Your linked specification for Semver 2.0.0 says the following in item 4:
Therefore it is following the semver spec. The plan is to release 1.0.0 once the API is stable and commonmark + gfm tests pass. |
Yep. That's fair. We'll get another library — this is obviously not stable enough for a normal workflow. Cheers. |
@deshiknaves I would recommend markdown-it They are very fast, extensible, and have quite a few plugins for GFM and other variations. |
This workaround should be documented in the README IMO, do you want me to provide a PR for this ? |
@wmarques yes please |
Good conversation here. Just to throw a bit on the fire: #1522 Anyone is welcome to help move Marked along toward the 1.0 future. Will probably post an update to the project status concept in the coming months. Sticking with the theme it'll probably be called: If only we had a holocaust cloak. :) |
I recently ran into a version mismatch between marked@0.8.0 and @types/marked@0.7.3. After downgrading marked to 0.7.0, our builds worked with IE. There is no package version for @types/marked@0.8.0 available at this time. |
Seriously, exporting |
bugfix for IE compatibility, thanks to markedjs/marked#1585 (comment)
This should be fixed by #1661 |
I totally would understand if you have no intention of fixing this :) But maybe you could add a note to the
README
;) We have just found out that the latest change to yourollup
configuration (loose
mode) produces output that isn't compatible with IE 11. In particular, it is the object shorthand that IE does not understand.Describe the bug
The latest
marked
version does not work in IE 11To Reproduce
Import it in any file and open this one in IE 11
Expected behavior
It works.
The text was updated successfully, but these errors were encountered: