@md-plugins/quasar-app-extension-q-press 0.1.0-beta.16 → 0.1.0-beta.17

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.
@@ -62,9 +62,31 @@ function rewriteRootRelativeUrls(content: string) {
62
62
 
63
63
  function indent(code: string, spaces = 2) {
64
64
  const padding = ' '.repeat(spaces)
65
+ let isInsideTemplateLiteral = false
66
+
65
67
  return code
66
68
  .split('\n')
67
- .map((line) => (line.trim().length > 0 ? padding + line : line))
69
+ .map((line) => {
70
+ const shouldIndent = line.trim().length > 0 && isInsideTemplateLiteral === false
71
+
72
+ for (let index = 0; index < line.length; index++) {
73
+ if (line[index] !== '`') {
74
+ continue
75
+ }
76
+
77
+ let escapeCount = 0
78
+
79
+ for (let escapeIndex = index - 1; escapeIndex >= 0 && line[escapeIndex] === '\\'; escapeIndex--) {
80
+ escapeCount++
81
+ }
82
+
83
+ if (escapeCount % 2 === 0) {
84
+ isInsideTemplateLiteral = !isInsideTemplateLiteral
85
+ }
86
+ }
87
+
88
+ return shouldIndent ? padding + line : line
89
+ })
68
90
  .join('\n')
69
91
  }
70
92
 
@@ -62,9 +62,31 @@ function rewriteRootRelativeUrls(content: string) {
62
62
 
63
63
  function indent(code: string, spaces = 2) {
64
64
  const padding = ' '.repeat(spaces)
65
+ let isInsideTemplateLiteral = false
66
+
65
67
  return code
66
68
  .split('\n')
67
- .map((line) => (line.trim().length > 0 ? padding + line : line))
69
+ .map((line) => {
70
+ const shouldIndent = line.trim().length > 0 && isInsideTemplateLiteral === false
71
+
72
+ for (let index = 0; index < line.length; index++) {
73
+ if (line[index] !== '`') {
74
+ continue
75
+ }
76
+
77
+ let escapeCount = 0
78
+
79
+ for (let escapeIndex = index - 1; escapeIndex >= 0 && line[escapeIndex] === '\\'; escapeIndex--) {
80
+ escapeCount++
81
+ }
82
+
83
+ if (escapeCount % 2 === 0) {
84
+ isInsideTemplateLiteral = !isInsideTemplateLiteral
85
+ }
86
+ }
87
+
88
+ return shouldIndent ? padding + line : line
89
+ })
68
90
  .join('\n')
69
91
  }
70
92
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@md-plugins/quasar-app-extension-q-press",
3
- "version": "0.1.0-beta.16",
3
+ "version": "0.1.0-beta.17",
4
4
  "description": "QPress - The Ultimate Markdown Solution for Quasar Framework",
5
5
  "keywords": [
6
6
  "markdown",
@@ -30,18 +30,18 @@
30
30
  "@types/markdown-it": "^14.1.2",
31
31
  "fs-extra": "^11.3.5",
32
32
  "markdown-it": "^14.2.0",
33
- "@md-plugins/md-plugin-blockquote": "0.1.0-beta.16",
34
- "@md-plugins/md-plugin-frontmatter": "0.1.0-beta.16",
35
- "@md-plugins/md-plugin-codeblocks": "0.1.0-beta.16",
36
- "@md-plugins/md-plugin-headers": "0.1.0-beta.16",
37
- "@md-plugins/md-plugin-containers": "0.1.0-beta.16",
38
- "@md-plugins/md-plugin-image": "0.1.0-beta.16",
39
- "@md-plugins/md-plugin-inlinecode": "0.1.0-beta.16",
40
- "@md-plugins/md-plugin-imports": "0.1.0-beta.16",
41
- "@md-plugins/md-plugin-link": "0.1.0-beta.16",
42
- "@md-plugins/md-plugin-table": "0.1.0-beta.16",
43
- "@md-plugins/vite-md-plugin": "0.1.0-beta.16",
44
- "@md-plugins/md-plugin-title": "0.1.0-beta.16"
33
+ "@md-plugins/md-plugin-codeblocks": "0.1.0-beta.17",
34
+ "@md-plugins/md-plugin-blockquote": "0.1.0-beta.17",
35
+ "@md-plugins/md-plugin-containers": "0.1.0-beta.17",
36
+ "@md-plugins/md-plugin-frontmatter": "0.1.0-beta.17",
37
+ "@md-plugins/md-plugin-imports": "0.1.0-beta.17",
38
+ "@md-plugins/md-plugin-image": "0.1.0-beta.17",
39
+ "@md-plugins/md-plugin-headers": "0.1.0-beta.17",
40
+ "@md-plugins/md-plugin-inlinecode": "0.1.0-beta.17",
41
+ "@md-plugins/md-plugin-link": "0.1.0-beta.17",
42
+ "@md-plugins/md-plugin-table": "0.1.0-beta.17",
43
+ "@md-plugins/vite-md-plugin": "0.1.0-beta.17",
44
+ "@md-plugins/md-plugin-title": "0.1.0-beta.17"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@quasar/app-vite": "3.0.0-beta.32",
@@ -62,9 +62,31 @@ function rewriteRootRelativeUrls(content: string) {
62
62
 
63
63
  function indent(code: string, spaces = 2) {
64
64
  const padding = ' '.repeat(spaces)
65
+ let isInsideTemplateLiteral = false
66
+
65
67
  return code
66
68
  .split('\n')
67
- .map((line) => (line.trim().length > 0 ? padding + line : line))
69
+ .map((line) => {
70
+ const shouldIndent = line.trim().length > 0 && isInsideTemplateLiteral === false
71
+
72
+ for (let index = 0; index < line.length; index++) {
73
+ if (line[index] !== '`') {
74
+ continue
75
+ }
76
+
77
+ let escapeCount = 0
78
+
79
+ for (let escapeIndex = index - 1; escapeIndex >= 0 && line[escapeIndex] === '\\'; escapeIndex--) {
80
+ escapeCount++
81
+ }
82
+
83
+ if (escapeCount % 2 === 0) {
84
+ isInsideTemplateLiteral = !isInsideTemplateLiteral
85
+ }
86
+ }
87
+
88
+ return shouldIndent ? padding + line : line
89
+ })
68
90
  .join('\n')
69
91
  }
70
92
 
@@ -62,9 +62,31 @@ function rewriteRootRelativeUrls(content: string) {
62
62
 
63
63
  function indent(code: string, spaces = 2) {
64
64
  const padding = ' '.repeat(spaces)
65
+ let isInsideTemplateLiteral = false
66
+
65
67
  return code
66
68
  .split('\n')
67
- .map((line) => (line.trim().length > 0 ? padding + line : line))
69
+ .map((line) => {
70
+ const shouldIndent = line.trim().length > 0 && isInsideTemplateLiteral === false
71
+
72
+ for (let index = 0; index < line.length; index++) {
73
+ if (line[index] !== '`') {
74
+ continue
75
+ }
76
+
77
+ let escapeCount = 0
78
+
79
+ for (let escapeIndex = index - 1; escapeIndex >= 0 && line[escapeIndex] === '\\'; escapeIndex--) {
80
+ escapeCount++
81
+ }
82
+
83
+ if (escapeCount % 2 === 0) {
84
+ isInsideTemplateLiteral = !isInsideTemplateLiteral
85
+ }
86
+ }
87
+
88
+ return shouldIndent ? padding + line : line
89
+ })
68
90
  .join('\n')
69
91
  }
70
92