File tree 1 file changed +25
-3
lines changed
1 file changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -162,13 +162,35 @@ function analyticsScript(analytics) {
162
162
` ;
163
163
}
164
164
165
+ // replace placeholders in text tokens
166
+ function replaceInText ( text ) {
167
+ return linkJsTypeDocs ( linkManPages ( text ) ) ;
168
+ }
169
+
165
170
// handle general body-text replacements
166
171
// for example, link man page references to the actual page
167
172
function parseText ( lexed ) {
168
173
lexed . forEach ( function ( tok ) {
169
- if ( tok . text && tok . type !== 'code' ) {
170
- tok . text = linkManPages ( tok . text ) ;
171
- tok . text = linkJsTypeDocs ( tok . text ) ;
174
+ if ( tok . type === 'table' ) {
175
+ if ( tok . cells ) {
176
+ tok . cells . forEach ( ( row , x ) => {
177
+ row . forEach ( ( _ , y ) => {
178
+ if ( tok . cells [ x ] && tok . cells [ x ] [ y ] ) {
179
+ tok . cells [ x ] [ y ] = replaceInText ( tok . cells [ x ] [ y ] ) ;
180
+ }
181
+ } ) ;
182
+ } ) ;
183
+ }
184
+
185
+ if ( tok . header ) {
186
+ tok . header . forEach ( ( _ , i ) => {
187
+ if ( tok . header [ i ] ) {
188
+ tok . header [ i ] = replaceInText ( tok . header [ i ] ) ;
189
+ }
190
+ } ) ;
191
+ }
192
+ } else if ( tok . text && tok . type !== 'code' ) {
193
+ tok . text = replaceInText ( tok . text ) ;
172
194
}
173
195
} ) ;
174
196
}
You can’t perform that action at this time.
0 commit comments