Skip to content

MarkedJS File Fetch File Error With: Uncaught Error: marked(): input parameter is of type [object Promise], string expected Please report this to https://github.com/markedjs/marked.  #3821

@lucheshidi

Description

@lucheshidi

Marked version: latest

Describe the bug
I imported using <script src> in what the Usage page says and my browser had an error that says Uncaught Error: marked(): input parameter is of type [object Promise], string expected
Please report this to https://github.com/markedjs/marked.

To Reproduce
Steps to reproduce the behavior:
Create an example html doc, and write:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>MarkedJS Document</title>

  <script src="https://cdn.jsdelivr.net/npm/marked/lib/marked.umd.js"></script>
</head>
<body>
  <div id="md-container"></div>
  <script>
    document.getElementById('md-container').innerHTML =
      marked.parse(fetch("example.md").trim()); // I used to fetch the md file content
  </script>
</body>
</html>

Expected behavior
A clear and concise description of what you expected to happen.
I just reloaded my live server to take the script affect and I see the error on the devtools js console in chrome.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions