Skip to content

Instantly share code, notes, and snippets.

davideiffert / insert_filename_as_header.rb
Last active Apr 12, 2020 — forked from JohnAtl/insert_filename_as_header.rb
Updated filename script to work with or without Zettelkasten ID
View insert_filename_as_header.rb
# Inserts the file's name as the first header in the file, if it isn't already there.
# Original file saved as filename.bak.
# As always, caveat emptor. This code could harm your files, so try it on a backup.
Dir.glob('*.md') do |filename|
puts "working on: #{filename}"
id_text = nil