-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into chore/custom-data-endpoint-for-latest-blo…
…g-posts
- Loading branch information
Showing
6 changed files
with
96 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bun | ||
|
||
import fs from 'fs'; | ||
|
||
if (!process.argv.slice(1).length) { | ||
console.error("👹 Oops! Missing the filename argument."); | ||
process.exit(1); | ||
} | ||
|
||
const args = process.argv.slice(1); | ||
const filePath = args[1]; | ||
const fileContent = fs.readFileSync(filePath, 'utf-8'); | ||
|
||
// Markdown headings | ||
const re1 = /---[\s\S]*?---/g; | ||
// Code blocks | ||
const re2 = /```[\s\S]*?```/g; | ||
// Named URL | ||
const re3 = /\[.*?\]\(.*?\)/g; | ||
|
||
try { | ||
const content = fileContent | ||
.replace(re1, '') | ||
.replace(re2, '') | ||
.replace(re3, '') | ||
.toLowerCase(); | ||
|
||
process.stdout.write(content); | ||
} catch (err) { | ||
console.error("👹 Oops! Failed to normalize the file for some reason..."); | ||
process.exit(1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters