@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.js CHANGED
@@ -1564,7 +1564,7 @@ var require_core = __commonJS({
1564
1564
  });
1565
1565
 
1566
1566
  // vue/NRpreviewer.ts
1567
- import { defineComponent as defineComponent12, h as h13 } from "vue";
1567
+ import { defineComponent as defineComponent12, h as h13, ref as ref6 } from "vue";
1568
1568
 
1569
1569
  // vue/CustomMarkdownRenderer.ts
1570
1570
  import { defineComponent as defineComponent11, h as h12, ref as ref5, computed, onMounted as onMounted4, onUnmounted as onUnmounted3, provide } from "vue";
@@ -1661,7 +1661,7 @@ function parseHtmlAttrs(attrsString) {
1661
1661
  // core/parser.ts
1662
1662
  function parseMarkdown(markdown2) {
1663
1663
  if (!markdown2) return [];
1664
- const lines = markdown2.split("\n");
1664
+ const lines = markdown2.replace(/\r\n/g, "\n").replace(/\r/g, "").split("\n");
1665
1665
  const result = [];
1666
1666
  let i = 0;
1667
1667
  while (i < lines.length) {
@@ -11830,8 +11830,10 @@ window.tailwind.config = {
11830
11830
  },
11831
11831
  };
11832
11832
  `;
11833
+ var isBrowser = () => typeof window !== "undefined" && typeof document !== "undefined";
11833
11834
  function useLazyTailwindCDN(enabled) {
11834
11835
  const injectCDN = () => {
11836
+ if (!isBrowser()) return;
11835
11837
  window.__twCDNRefs = (window.__twCDNRefs ?? 0) + 1;
11836
11838
  if (!document.getElementById(CONFIG_ID)) {
11837
11839
  const configScript = document.createElement("script");
@@ -11847,6 +11849,7 @@ function useLazyTailwindCDN(enabled) {
11847
11849
  }
11848
11850
  };
11849
11851
  const removeCDN = () => {
11852
+ if (!isBrowser()) return;
11850
11853
  window.__twCDNRefs = (window.__twCDNRefs ?? 1) - 1;
11851
11854
  if ((window.__twCDNRefs ?? 0) <= 0) {
11852
11855
  document.getElementById(SCRIPT_ID)?.remove();
@@ -11872,10 +11875,12 @@ function useLazyTailwindCDN(enabled) {
11872
11875
  }
11873
11876
  }
11874
11877
  function scanTailwindCDN() {
11878
+ if (typeof window === "undefined") return;
11875
11879
  const tw = window.tailwind;
11876
11880
  if (tw?.scan) tw.scan();
11877
11881
  }
11878
11882
  function preloadTailwindCDN() {
11883
+ if (typeof window === "undefined" || typeof document === "undefined") return;
11879
11884
  if (document.getElementById(SCRIPT_ID)) return;
11880
11885
  const inject2 = () => {
11881
11886
  if (document.getElementById(SCRIPT_ID)) return;
@@ -12152,7 +12157,6 @@ var CustomMarkdownRenderer = defineComponent11({
12152
12157
  var CustomMarkdownRenderer_default = CustomMarkdownRenderer;
12153
12158
 
12154
12159
  // vue/NRpreviewer.ts
12155
- import { ref as ref6 } from "vue";
12156
12160
  var NRpreviewer = defineComponent12({
12157
12161
  name: "NRpreviewer",
12158
12162
  props: {
@@ -12164,7 +12168,9 @@ var NRpreviewer = defineComponent12({
12164
12168
  },
12165
12169
  setup(props) {
12166
12170
  const tailwindEnabled = ref6(props.tailwindCDN);
12167
- useLazyTailwindCDN(tailwindEnabled);
12171
+ if (typeof window !== "undefined") {
12172
+ useLazyTailwindCDN(tailwindEnabled);
12173
+ }
12168
12174
  return () => {
12169
12175
  const wrapperClass = `nr-prose${props.className ? ` ${props.className}` : ""}`;
12170
12176
  if (props.content) {