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

Allow additional javascript attributes in the configuration #2444

Open
h7kanna opened this issue Oct 8, 2024 · 1 comment
Open

Allow additional javascript attributes in the configuration #2444

h7kanna opened this issue Oct 8, 2024 · 1 comment
Assignees
Labels
C-enhancement Category: Enhancement or feature request

Comments

@h7kanna
Copy link

h7kanna commented Oct 8, 2024

Problem

I am not able to include a JavaScript module in the additional_js option.

Example:

<!-- Custom JS scripts -->
<script src="custom-js/index.js" type="module" async></script>

Currently, the configuration is only a list of file name strings.
Also the custom head.hbs cannot be used as additional_js is only for local files.

Proposed Solution

Provide new additional-js-attributes option augmenting the existing additional-js option.

Example:

[output.html]
additional-js = ["custom-js/index.js", "custom-js/xtermjs"]
additional-js-attributes = [
  [
    { type = "module" },
    { async = true },
  ],
  [
    { type = "module" },
    { async = true },
  ],
]

Notes

Demo implementation is here master...h7kanna:mdBook:additional-js-attributes

@h7kanna h7kanna added the C-enhancement Category: Enhancement or feature request label Oct 8, 2024
@h7kanna
Copy link
Author

h7kanna commented Oct 8, 2024

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement or feature request
Projects
None yet
Development

No branches or pull requests

1 participant