add code line number
This commit is contained in:
		
							parent
							
								
									8647a69ffb
								
							
						
					
					
						commit
						184c03b204
					
				
					 1 changed files with 13 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -179,7 +179,19 @@
 | 
			
		|||
 | 
			
		||||
  // ---------- LISTING ----------
 | 
			
		||||
  show raw.where(block: true): it => {
 | 
			
		||||
    block(radius: 1em, fill: luma(240), inset: 1em, width: 80%, {
 | 
			
		||||
    // Line number, not verry good (cannot copy code whitout line number)
 | 
			
		||||
    // see https://github.com/typst/typst/issues/344
 | 
			
		||||
    show raw.line: line => {
 | 
			
		||||
      if line.number < 10 {
 | 
			
		||||
        text(fill: gray)[~#line.number]
 | 
			
		||||
      } else {
 | 
			
		||||
        text(fill: gray)[#line.number]
 | 
			
		||||
      }
 | 
			
		||||
      h(1em)
 | 
			
		||||
      line.body
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    block(radius: 1em, fill: luma(240), inset: 1em, width: 90%, {
 | 
			
		||||
      set align(left)
 | 
			
		||||
      it
 | 
			
		||||
    })
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue