@clidey/dory 0.16.0 → 0.18.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/k8s/Dockerfile CHANGED
@@ -7,7 +7,7 @@ RUN apk add --no-cache git
7
7
 
8
8
  COPY ./k8s/config/nginx-default.conf /app/k8s/config/nginx-default.conf
9
9
 
10
- RUN npm install -g @clidey/dory@0.15.0
10
+ RUN npm install -g @clidey/dory@0.18.0
11
11
  EXPOSE 3000
12
12
 
13
13
  CMD ["dory", "preview"]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@clidey/dory",
3
3
  "private": false,
4
- "version": "0.16.0",
4
+ "version": "0.18.0",
5
5
  "type": "module",
6
6
  "description": "A CLI tool for building and previewing documentation sites",
7
7
  "keywords": [
@@ -100,21 +100,46 @@ export function preprocessMdxTags() {
100
100
  // Otherwise, leave as-is for proper JSX parsing
101
101
  return match;
102
102
  }
103
-
103
+ // For unknown components, always treat as text (wrap in backticks)
104
104
  // If already inside backticks, do not wrap again
105
- // Find the start of the line up to the match
106
105
  const before = processed.slice(0, offset);
107
- // Count the number of backticks before this tag
108
106
  const backtickMatches = before.match(/`+/g);
109
- // If the number of backticks is odd, we're inside a backtick span
110
107
  const insideBackticks = backtickMatches ? backtickMatches.reduce((acc, s) => acc + s.length, 0) % 2 === 1 : false;
111
108
  if (insideBackticks) {
112
109
  return match;
113
110
  }
114
- // Otherwise, wrap in backticks to prevent JSX parsing
115
111
  return `\`<${tag}>\``;
116
112
  });
117
113
 
114
+ // This regex finds all <tag> and </tag> occurrences
115
+ processed = processed.replace(/<\/?([a-z][a-z0-9]*)>/gi, (match, tag, offset) => {
116
+ // If inside a code block, do not touch
117
+ if (isInsideCodeBlock(processed, offset)) {
118
+ return match;
119
+ }
120
+
121
+ // If known component, check if it has a closing tag (only for opening tags)
122
+ if (KNOWN_COMPONENTS.includes(tag)) {
123
+ // Only check for matching closing tag for opening tags
124
+ if (!match.startsWith('</')) {
125
+ if (!hasMatchingClosingTag(processed, tag, offset)) {
126
+ return `\`${match}\``;
127
+ }
128
+ }
129
+ // Otherwise, leave as-is for proper JSX parsing
130
+ return match;
131
+ }
132
+ // For unknown components, always treat as text (wrap in backticks)
133
+ // If already inside backticks, do not wrap again
134
+ const before = processed.slice(0, offset);
135
+ const backtickMatches = before.match(/`+/g);
136
+ const insideBackticks = backtickMatches ? backtickMatches.reduce((acc, s) => acc + s.length, 0) % 2 === 1 : false;
137
+ if (insideBackticks) {
138
+ return match;
139
+ }
140
+ return `\`${match}\``;
141
+ });
142
+
118
143
  return {
119
144
  code: processed,
120
145
  map: null,