web-remarq 0.7.0 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -33,10 +33,12 @@ WebRemarq.init({ theme: 'light' })
33
33
  ### Script tag
34
34
 
35
35
  ```html
36
- <script src="https://unpkg.com/web-remarq/dist/web-remarq.global.global.js"></script>
36
+ <script src="https://unpkg.com/web-remarq/dist/web-remarq.global.js"></script>
37
37
  <script>WebRemarq.init({ theme: 'dark' })</script>
38
38
  ```
39
39
 
40
+ Works in `<head>` or `<body>` — if `init()` runs before `document.body` exists, it defers itself to `DOMContentLoaded` automatically.
41
+
40
42
  ## API
41
43
 
42
44
  ### `WebRemarq.init(options?)`
package/dist/index.cjs CHANGED
@@ -3054,6 +3054,10 @@ var WebRemarq = {
3054
3054
  init(opts) {
3055
3055
  var _a3, _b;
3056
3056
  if (initialized) return;
3057
+ if (!document.body) {
3058
+ document.addEventListener("DOMContentLoaded", () => WebRemarq.init(opts), { once: true });
3059
+ return;
3060
+ }
3057
3061
  options = opts != null ? opts : {};
3058
3062
  try {
3059
3063
  injectStyles();