0

Have been trying to use the remarkable.js within my application without much success.

script.js

import { Remarkable } from 'remarkable';
var md = new Remarkable();

index.html

<script src="https://cdn.jsdelivr.net/remarkable/1.7.1/remarkable.min.js"></script>
<script type="module" src="js/script.js"></script>

The error is TypeError: Failed to resolve module specifier "remarkable". Relative references must start with either "/", "./", or "../".

FZs
  • 16,581
  • 13
  • 41
  • 50
Sunil Nair
  • 51
  • 2
  • 8
  • Does this answer your question? [Relative references must start with either "/", "./", or "../"](https://stackoverflow.com/questions/56507441/relative-references-must-start-with-either-or) – FZs Feb 09 '21 at 18:03

1 Answers1

3

If you use the cdn script, you can't "import" remarkable, but it will be available globally. You can import it if you use bundler like webpack or rollup.

just do:

var md = new Remarkable();
Jérémie B
  • 10,611
  • 1
  • 26
  • 43