-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
code fences around generated files #20
Comments
Here's a ruby script I had ChatGPT write to tidy those up: #!/usr/bin/env ruby
require 'fileutils'
# Glob all JavaScript files in the current directory
Dir.glob('src/**/*.js').each do |filename|
p filename
lines = File.readlines(filename)
# Check if the first line is a starting code fence and the last line is an ending code fence
if lines.first.chomp.index("```") === 0 && lines.last.chomp == "```"
# Remove the first and last lines
lines.shift
lines.pop
# Write the modified lines back to the file
File.open(filename, 'w') do |file|
file.puts(lines)
end
end
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any time I ask
smol-dev-js
to create or modify a file it adds code fences at the top and bottom of the file (```javascript
at the beginning and```
at the end).I can ask
smol-dev-js
to remove them but then it adds them back with the next command.The text was updated successfully, but these errors were encountered: