@noirmd/previewer 1.1.0 → 1.2.0

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/dist/vue.cjs CHANGED
@@ -32,7 +32,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
32
32
 
33
33
  // node_modules/highlight.js/lib/core.js
34
34
  var require_core = __commonJS({
35
- "node_modules/highlight.js/lib/core.js"(exports2, module2) {
35
+ "node_modules/highlight.js/lib/core.js"(exports, module2) {
36
36
  "use strict";
37
37
  function deepFreeze(obj) {
38
38
  if (obj instanceof Map) {
@@ -1685,7 +1685,7 @@ function parseHtmlAttrs(attrsString) {
1685
1685
  // core/parser.ts
1686
1686
  function parseMarkdown(markdown2) {
1687
1687
  if (!markdown2) return [];
1688
- const lines = markdown2.split("\n");
1688
+ const lines = markdown2.replace(/\r\n/g, "\n").replace(/\r/g, "").split("\n");
1689
1689
  const result = [];
1690
1690
  let i = 0;
1691
1691
  while (i < lines.length) {
@@ -11854,8 +11854,10 @@ window.tailwind.config = {
11854
11854
  },
11855
11855
  };
11856
11856
  `;
11857
+ var isBrowser = () => typeof window !== "undefined" && typeof document !== "undefined";
11857
11858
  function useLazyTailwindCDN(enabled) {
11858
11859
  const injectCDN = () => {
11860
+ if (!isBrowser()) return;
11859
11861
  window.__twCDNRefs = (window.__twCDNRefs ?? 0) + 1;
11860
11862
  if (!document.getElementById(CONFIG_ID)) {
11861
11863
  const configScript = document.createElement("script");
@@ -11871,6 +11873,7 @@ function useLazyTailwindCDN(enabled) {
11871
11873
  }
11872
11874
  };
11873
11875
  const removeCDN = () => {
11876
+ if (!isBrowser()) return;
11874
11877
  window.__twCDNRefs = (window.__twCDNRefs ?? 1) - 1;
11875
11878
  if ((window.__twCDNRefs ?? 0) <= 0) {
11876
11879
  document.getElementById(SCRIPT_ID)?.remove();
@@ -11896,10 +11899,12 @@ function useLazyTailwindCDN(enabled) {
11896
11899
  }
11897
11900
  }
11898
11901
  function scanTailwindCDN() {
11902
+ if (typeof window === "undefined") return;
11899
11903
  const tw = window.tailwind;
11900
11904
  if (tw?.scan) tw.scan();
11901
11905
  }
11902
11906
  function preloadTailwindCDN() {
11907
+ if (typeof window === "undefined" || typeof document === "undefined") return;
11903
11908
  if (document.getElementById(SCRIPT_ID)) return;
11904
11909
  const inject2 = () => {
11905
11910
  if (document.getElementById(SCRIPT_ID)) return;
@@ -12176,7 +12181,6 @@ var CustomMarkdownRenderer = (0, import_vue14.defineComponent)({
12176
12181
  var CustomMarkdownRenderer_default = CustomMarkdownRenderer;
12177
12182
 
12178
12183
  // vue/NRpreviewer.ts
12179
- var import_vue16 = require("vue");
12180
12184
  var NRpreviewer = (0, import_vue15.defineComponent)({
12181
12185
  name: "NRpreviewer",
12182
12186
  props: {
@@ -12187,8 +12191,10 @@ var NRpreviewer = (0, import_vue15.defineComponent)({
12187
12191
  style: { type: Object, default: void 0 }
12188
12192
  },
12189
12193
  setup(props) {
12190
- const tailwindEnabled = (0, import_vue16.ref)(props.tailwindCDN);
12191
- useLazyTailwindCDN(tailwindEnabled);
12194
+ const tailwindEnabled = (0, import_vue15.ref)(props.tailwindCDN);
12195
+ if (typeof window !== "undefined") {
12196
+ useLazyTailwindCDN(tailwindEnabled);
12197
+ }
12192
12198
  return () => {
12193
12199
  const wrapperClass = `nr-prose${props.className ? ` ${props.className}` : ""}`;
12194
12200
  if (props.content) {
@@ -12209,19 +12215,4 @@ var NRpreviewer = (0, import_vue15.defineComponent)({
12209
12215
  }
12210
12216
  });
12211
12217
  var NRpreviewer_default = NRpreviewer;
12212
- // Annotate the CommonJS export names for ESM import in node:
12213
- 0 && (module.exports = {
12214
- Admonition,
12215
- CodeBlock,
12216
- CustomMarkdownRenderer,
12217
- Details,
12218
- IconRenderer,
12219
- Modal,
12220
- NRpreviewer,
12221
- extractHeaders,
12222
- parseMarkdown,
12223
- preloadTailwindCDN,
12224
- scanTailwindCDN,
12225
- useLazyTailwindCDN
12226
- });
12227
12218
  //# sourceMappingURL=vue.cjs.map