Skip to content

Suggestions for source formatting before syntax highlighting #3748

Answered by dwkns
deejaygraham asked this question in Q&A
Discussion options

You must be logged in to vote

Assuming this is a one off process, I'd probably go down the route you suggested: write a script to process all your markdown files.

  • Make a backup of your files before you start.
  • Read the markdown file
  • Extract the codebloks (you could use a regex for this)
  • Run Prettier against the extracted code.
  • Save it back.

If you're no good with regex, ask one other LLM's they are pretty good at writing them for you. Or ask it to just write the whole script for you.

Alternatively, this is the sort of task that cursor could probably do for you.

You could do this in a more 11ty style way by writing your code in [eleventy.before](https://www.11ty.dev/docs/events/#eleventy-before) function. But then you…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@deejaygraham
Comment options

Answer selected by deejaygraham
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants