Skip to content

Example doesn't work #84

Open
Open
@legodude17

Description

@legodude17
  • remark-embedder-core version: 3.0.1
  • node version: 18.4.0
  • npm version: 8.13.0

Relevant code or config

Example in the README.

What you did:
Ran the code.

What happened:

Got an error:

import remark from 'remark'
       ^^^^^^
SyntaxError: The requested module 'remark' does not provide an export named 'default'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:128:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:194:5)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:409:24)
    at async loadESM (node:internal/process/esm_loader:85:5)
    at async handleMainPromise (node:internal/modules/run_main:61:12)

Node.js v18.4.0

After fixing this, it runs but does not embed properly.

After fixing that, the URL is completely removed.

Suggested solution:

For the first issue, you must wrap remark in brackets.

For the second, you need to add a .default when using remarkEmbedder.

For the third, you need to add { sanitize: false } when using the remark-html plugin, since otherwise it's sanitization will remove the iframe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions