Style invalid bracket links (grey them out)
This commit is contained in:
		
							parent
							
								
									385ef3a852
								
							
						
					
					
						commit
						1a0a706556
					
				| @ -18,6 +18,19 @@ class BidirectionalLinksGenerator < Jekyll::Generator | |||||||
|           "<a class='internal-link' href='#{note_potentially_linked_to.url}'>#{note_potentially_linked_to.data['title']}</a>" |           "<a class='internal-link' href='#{note_potentially_linked_to.url}'>#{note_potentially_linked_to.data['title']}</a>" | ||||||
|         ) |         ) | ||||||
|       end |       end | ||||||
|  | 
 | ||||||
|  |       # At this point, all remaining double-bracket-wrapped words are | ||||||
|  |       # pointing to non-existing pages, so let's turn them into disabled | ||||||
|  |       # links by greying them out and changing the cursor | ||||||
|  |       current_note.content = current_note.content.gsub( | ||||||
|  |         /\[\[?(.*)\]\]/i, # match on the remaining double-bracket links | ||||||
|  |         <<~HTML.chomp     # replace with this HTML (\\1 is what was inside the brackets) | ||||||
|  |           <span title='There is no note that matches this title.' class='invalid-link'> | ||||||
|  |             <span class='invalid-link-brackets'>[[</span> | ||||||
|  |             \\1 | ||||||
|  |             <span class='invalid-link-brackets'>]]</span></span> | ||||||
|  |         HTML | ||||||
|  |       ) | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     # Identify note backlinks and add them to each note |     # Identify note backlinks and add them to each note | ||||||
|  | |||||||
| @ -128,3 +128,15 @@ code { | |||||||
|   padding: 0.1em 0.2em; |   padding: 0.1em 0.2em; | ||||||
|   border-radius: 4px; |   border-radius: 4px; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | .invalid-link { | ||||||
|  |   color: #444444; | ||||||
|  |   cursor: help; | ||||||
|  |   background: #fafafa; | ||||||
|  |   padding: 0 0.1em; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .invalid-link-brackets { | ||||||
|  |   color: #ccc; | ||||||
|  |   cursor: help; | ||||||
|  | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Maxime Vaillancourt
						Maxime Vaillancourt