File tree 2 files changed +17
-4
lines changed
packages/gitbook/src/components/DocumentView
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 {
5
5
DocumentMarkItalic ,
6
6
DocumentMarkKeyboard ,
7
7
DocumentMarkStrikethrough ,
8
+ DocumentMarkSubscript ,
9
+ DocumentMarkSuperscript ,
8
10
DocumentText ,
9
11
DocumentTextMark ,
10
12
} from '@gitbook/api' ;
@@ -47,10 +49,8 @@ const MARK_STYLES = {
47
49
strikethrough : Strikethrough ,
48
50
color : Color ,
49
51
keyboard : Keyboard ,
50
-
51
- // TODO: add support for these marks
52
- subscript : null ,
53
- superscript : null ,
52
+ superscript : Superscript ,
53
+ subscript : Subscript ,
54
54
} ;
55
55
56
56
interface MarkedLeafProps < Mark extends DocumentTextMark > {
@@ -78,6 +78,14 @@ function Keyboard(props: MarkedLeafProps<DocumentMarkKeyboard>) {
78
78
) ;
79
79
}
80
80
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
+
81
89
function Code ( props : MarkedLeafProps < DocumentMarkCode > ) {
82
90
return (
83
91
< code
You can’t perform that action at this time.
0 commit comments