File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed 
packages/gitbook/src/components/DocumentView Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 1+ --- 
2+ " gitbook " patch 
3+ --- 
4+ 
5+ Add superscript and subscript text rendering
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import type {
55    DocumentMarkItalic , 
66    DocumentMarkKeyboard , 
77    DocumentMarkStrikethrough , 
8+     DocumentMarkSubscript , 
9+     DocumentMarkSuperscript , 
810    DocumentText , 
911    DocumentTextMark , 
1012}  from  '@gitbook/api' ; 
@@ -47,10 +49,8 @@ const MARK_STYLES = {
4749    strikethrough : Strikethrough , 
4850    color : Color , 
4951    keyboard : Keyboard , 
50- 
51-     // TODO: add support for these marks 
52-     subscript : null , 
53-     superscript : null , 
52+     superscript : Superscript , 
53+     subscript : Subscript , 
5454} ; 
5555
5656interface  MarkedLeafProps < Mark  extends  DocumentTextMark >  { 
@@ -78,6 +78,14 @@ function Keyboard(props: MarkedLeafProps<DocumentMarkKeyboard>) {
7878    ) ; 
7979} 
8080
81+ function  Superscript ( props : MarkedLeafProps < DocumentMarkSuperscript > )  { 
82+     return  < sup > { props . children } </ sup > ; 
83+ } 
84+ 
85+ function  Subscript ( props : MarkedLeafProps < DocumentMarkSubscript > )  { 
86+     return  < sub > { props . children } </ sub > ; 
87+ } 
88+ 
8189function  Code ( props : MarkedLeafProps < DocumentMarkCode > )  { 
8290    return  ( 
8391        < code 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments