Add new internal ref shortcodes
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
		
							parent
							
								
									9536c9fb25
								
							
						
					
					
						commit
						431d4b0990
					
				| @ -478,3 +478,24 @@ blockquote { | ||||
| .side-by-side-item { | ||||
|   flex-basis: 0; | ||||
| } | ||||
| 
 | ||||
| .internal-ref { | ||||
|   text-decoration: underline; | ||||
|   break-inside: avoid; | ||||
| 
 | ||||
|   &:target { | ||||
|     @include var(background-color, target-background-color); | ||||
|     border-radius: 1rem; | ||||
| 
 | ||||
|     .internal-ref-counter { | ||||
|       @include var(background-color, target-background-color); | ||||
|     } | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| .internal-ref-counter { | ||||
|   display: inline-block; | ||||
|   border: $standard-border; | ||||
|   border-radius: 0.5rem; | ||||
|   padding: 0 0.25rem 0 0.25rem; | ||||
| } | ||||
|  | ||||
							
								
								
									
										12
									
								
								layouts/shortcodes/internal.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								layouts/shortcodes/internal.html
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | ||||
| {{- $name := .Get 0 -}} | ||||
| {{- $number := 1 -}} | ||||
| {{- with .Page.Scratch.Get "internal-ref-counter" -}} | ||||
| {{- $number = add . 1 }} | ||||
| {{- end -}} | ||||
| {{- .Page.Scratch.Set "internal-ref-counter" $number -}} | ||||
| {{- .Page.Scratch.SetInMap "internal-ref" $name $number -}} | ||||
| 
 | ||||
| <span class="internal-ref" id="internal-ref-{{ $name }}"> | ||||
| {{ .Inner }} | ||||
| <span class="internal-ref-counter">{{ $number }}</span></span> | ||||
| {{- /* chomp whitespace at the end */ -}} | ||||
							
								
								
									
										7
									
								
								layouts/shortcodes/internalref.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								layouts/shortcodes/internalref.html
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,7 @@ | ||||
| {{- $name := .Get 0 -}} | ||||
| {{- $number := index (.Page.Scratch.Get "internal-ref") $name -}} | ||||
| 
 | ||||
| <a href="#internal-ref-{{ $name }}"> | ||||
| {{ .Inner }} | ||||
| <span class="internal-ref-counter">{{ $number }}</span></a> | ||||
| {{- /* chomp whitespace at the end */ -}} | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user