Skip to content

Commit

Permalink
Merge pull request #5 from CharlesEkkel/bugfix/handle-whitespace-and-…
Browse files Browse the repository at this point in the history
…broken-links

Bugfix: Handle whitespace and broken links
  • Loading branch information
goshatch authored Nov 13, 2023
2 parents 448267e + 4269fc6 commit 7262f23
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def filename
private

def input_file_to_md
PandocRuby.new([input_file], from: 'org', wrap: 'none').to_gfm
PandocRuby.new([(Regexp.escape input_file)], from: 'org', wrap: 'none').to_gfm
end

def sanitize(row)
Expand Down Expand Up @@ -84,7 +84,11 @@ def convert_links(note)
target_note_id = link_target.sub('id:', '')
target_note = @notes[target_note_id]

"[[#{target_note.title}]]"
if target_note.nil?
"[Note not found: #{link_text}](#{link_target})"
else
"[[#{target_note.title}]]"
end
else
"[#{link_text}](#{link_target})"
end
Expand Down

0 comments on commit 7262f23

Please sign in to comment.