Add support for Roam-style link syntax on pages
This commit is contained in:
parent
f62c1bc453
commit
2436845ca4
@ -7,5 +7,5 @@ permalink: /
|
||||
|
||||
<div>
|
||||
<h1>Welcome! 🌱</h1>
|
||||
<p>This is your digital garden. Here's the <a href="/your-first-note">first note</a> to get started on your exploration.</p>
|
||||
<p>This is your digital garden. Here's [[Your first seed]] to get started on your exploration.</p>
|
||||
</div>
|
||||
|
@ -2,9 +2,12 @@
|
||||
class BidirectionalLinksGenerator < Jekyll::Generator
|
||||
def generate(site)
|
||||
all_notes = site.collections['notes'].docs
|
||||
all_pages = site.pages
|
||||
|
||||
all_notes.each do |current_note|
|
||||
all_notes.each do |note_potentially_linked_to|
|
||||
all_docs = all_notes + all_pages
|
||||
|
||||
all_docs.each do |current_note|
|
||||
all_docs.each do |note_potentially_linked_to|
|
||||
current_note.content = current_note.content.gsub(
|
||||
/\[\[#{note_potentially_linked_to.data['title']}\]\]/i,
|
||||
"<a class='internal-link' href='#{note_potentially_linked_to.url}'>#{note_potentially_linked_to.data['title']}</a>"
|
||||
|
Loading…
x
Reference in New Issue
Block a user