Skip to content
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

--engine ./engine.js doesn't render code blocks well #168

Closed
exKAZUu opened this issue Oct 4, 2019 · 3 comments · Fixed by #172
Closed

--engine ./engine.js doesn't render code blocks well #168

exKAZUu opened this issue Oct 4, 2019 · 3 comments · Fixed by #172
Labels
bug Something isn't working

Comments

@exKAZUu
Copy link

exKAZUu commented Oct 4, 2019

I have the following files.

  • engine.js

    const { Marp } = require('@marp-team/marp-core');
    module.exports = opts => new Marp(opts);
    

    Note: I've also tested module.exports = opts => new Marp();, but there seems no difference.

  • sample.md

    # test
    
    ` ` ` <- We cannot use triple backquoations in clode blocks so I use ` ` ` here instead
    console.log('Hello World!');
    ` ` `
    
  • package.json

    ...
    "devDependencies": {
      "@marp-team/marp-cli": "0.14.1",
      "@marp-team/marp-core": "0.13.1",
      "@marp-team/marpit": "1.4.0",
    ...
    

When I use --engine @marp-team/marp-core, it works well.
Interestingly, when I use --engine ./engine.js, it doesn't render the code block well as follows.

image

@exKAZUu
Copy link
Author

exKAZUu commented Oct 4, 2019

I upload the generated html file as .txt file here.

sample.html.txt

@exKAZUu exKAZUu changed the title --engine ./engine.js doen't render the code block --engine ./engine.js doesn't render the code block well Oct 4, 2019
@exKAZUu exKAZUu changed the title --engine ./engine.js doesn't render the code block well --engine ./engine.js doesn't render code blocks well Oct 4, 2019
@yhatt
Copy link
Member

yhatt commented Oct 4, 2019

Thanks for feedback. Perhaps it's not triggered Marp.ready() on the browser context.

Marp Core package has defined path to JS for bundling with HTML, but it's cannot in functional engine. We should consider a way to add browser script by custom engine.

As a workaround, load Marp Core's browser script manually in Markdown. (require --html option)

# Your contents

...

<script defer src="https://cdn.jsdelivr.net/npm/@marp-team/marp-core/lib/browser.js"></script>

@exKAZUu
Copy link
Author

exKAZUu commented Oct 4, 2019

Thank you for your quick response. I confirm the workaround solves this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants