mirror of
https://github.com/Axorax/awesome-free-apps.git
synced 2025-12-29 16:14:53 +00:00
Add: more apps
This commit is contained in:
32
labelReverse.js
Normal file
32
labelReverse.js
Normal file
@@ -0,0 +1,32 @@
|
||||
const fs = require('fs');
|
||||
|
||||
fs.readFile('test.md', 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
console.error('Error reading file:', err);
|
||||
return;
|
||||
}
|
||||
|
||||
let lines = data.split('\n');
|
||||
|
||||
const modifiedLines = lines.map(line => {
|
||||
if (line.includes('![')) {
|
||||
const icons = line.match(/!\[[^\]]+\]\([^\)]+\)/g);
|
||||
if (icons) {
|
||||
let remainingContent = line.replace(/!\[[^\]]+\]\([^\)]+\)/g, '').trim();
|
||||
remainingContent = remainingContent.replace(/^\s*-?\s*/, '');
|
||||
return `- ${icons.join(' ')} ${remainingContent}`;
|
||||
}
|
||||
}
|
||||
return line;
|
||||
});
|
||||
|
||||
const modifiedData = modifiedLines.join('\n');
|
||||
|
||||
fs.writeFile('output.md', modifiedData, (err) => {
|
||||
if (err) {
|
||||
console.error('Error writing file:', err);
|
||||
} else {
|
||||
console.log('File successfully written to output.md');
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user