@entro314labs/markdownfix 0.0.12 → 0.0.14
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/.remarkrc.js +2 -1
- package/cli.js +16 -5
- package/package.json +1 -1
package/.remarkrc.js
CHANGED
|
@@ -32,7 +32,7 @@ export default {
|
|
|
32
32
|
emphasis: '_', // Use _emphasis_ over *emphasis*
|
|
33
33
|
strong: '*', // Use **strong** over __strong__
|
|
34
34
|
fence: '`', // Use ``` for code fences
|
|
35
|
-
fences: true, //
|
|
35
|
+
fences: true, // Use fences for code blocks (disabled for MDX in cli.js)
|
|
36
36
|
incrementListMarker: true, // Increment ordered list markers
|
|
37
37
|
listItemIndent: 'one', // Use one space for list indentation
|
|
38
38
|
quote: '"', // Use double quotes in titles
|
|
@@ -41,6 +41,7 @@ export default {
|
|
|
41
41
|
ruleSpaces: false, // No spaces in horizontal rules
|
|
42
42
|
setext: false, // Use # instead of === underlines
|
|
43
43
|
tightDefinitions: true, // No blank lines between definitions
|
|
44
|
+
resourceLink: false, // Don't escape link URLs unnecessarily
|
|
44
45
|
},
|
|
45
46
|
|
|
46
47
|
plugins: [
|
package/cli.js
CHANGED
|
@@ -139,10 +139,12 @@ async function processFiles(files, options = {}) {
|
|
|
139
139
|
|
|
140
140
|
// Add stringify for formatting (unless lint-only)
|
|
141
141
|
if (!lintOnly) {
|
|
142
|
+
// For MDX files, disable fences to prevent JSX from being wrapped in code blocks
|
|
143
|
+
const isMdx = filePath.endsWith('.mdx') || filePath.endsWith('.mdd');
|
|
142
144
|
processor = processor.use(remarkStringify, {
|
|
143
145
|
bullet: '-',
|
|
144
146
|
emphasis: '_',
|
|
145
|
-
fences:
|
|
147
|
+
fences: !isMdx, // Disable fences for MDX to preserve JSX
|
|
146
148
|
listItemIndent: 'one',
|
|
147
149
|
rule: '-',
|
|
148
150
|
strong: '*',
|
|
@@ -207,10 +209,17 @@ async function runNuclearMode(files, options = {}) {
|
|
|
207
209
|
steps.push({
|
|
208
210
|
name: 'Remark Format',
|
|
209
211
|
success: !result.hasErrors,
|
|
210
|
-
details: `
|
|
212
|
+
details: `Wrote ${result.processedCount}/${result.totalFiles} files`
|
|
211
213
|
});
|
|
212
214
|
if (result.hasErrors) overallSuccess = false;
|
|
213
|
-
if (!quiet)
|
|
215
|
+
if (!quiet) {
|
|
216
|
+
console.log(` ✓ Remark formatting completed (${result.processedCount} files written)`);
|
|
217
|
+
if (result.hasErrors) {
|
|
218
|
+
console.log(` ⚠️ Some files had lint warnings (but were still formatted)\n`);
|
|
219
|
+
} else {
|
|
220
|
+
console.log();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
214
223
|
} catch (error) {
|
|
215
224
|
steps.push({ name: 'Remark Format', success: false, details: error.message });
|
|
216
225
|
overallSuccess = false;
|
|
@@ -250,7 +259,8 @@ async function runNuclearMode(files, options = {}) {
|
|
|
250
259
|
// Step 3: ESLint auto-fix
|
|
251
260
|
if (!quiet) console.log('Step 3/4: Running ESLint auto-fix...');
|
|
252
261
|
try {
|
|
253
|
-
|
|
262
|
+
// Quote each file path to handle spaces and special characters
|
|
263
|
+
const fileList = files.map(f => `"${f}"`).join(' ');
|
|
254
264
|
const eslintCmd = `npx eslint --config "${configPath}" --fix ${fileList}`;
|
|
255
265
|
|
|
256
266
|
try {
|
|
@@ -273,7 +283,8 @@ async function runNuclearMode(files, options = {}) {
|
|
|
273
283
|
// Step 4: ESLint linting
|
|
274
284
|
if (!quiet) console.log('Step 4/4: Running ESLint linting...');
|
|
275
285
|
try {
|
|
276
|
-
|
|
286
|
+
// Quote each file path to handle spaces and special characters
|
|
287
|
+
const fileList = files.map(f => `"${f}"`).join(' ');
|
|
277
288
|
const eslintCmd = `npx eslint --config "${configPath}" ${fileList}`;
|
|
278
289
|
|
|
279
290
|
execSync(eslintCmd, {
|
package/package.json
CHANGED