@@ -159,9 +159,9 @@ func PostProcessDefault(ctx *RenderContext, input io.Reader, output io.Writer) e
159
159
return postProcess (ctx , procs , input , output )
160
160
}
161
161
162
- // RenderCommitMessage will use the same logic as PostProcess, but will disable
162
+ // PostProcessCommitMessage will use the same logic as PostProcess, but will disable
163
163
// the shortLinkProcessor.
164
- func RenderCommitMessage (ctx * RenderContext , content string ) (string , error ) {
164
+ func PostProcessCommitMessage (ctx * RenderContext , content string ) (string , error ) {
165
165
procs := []processor {
166
166
fullIssuePatternProcessor ,
167
167
comparePatternProcessor ,
@@ -183,11 +183,11 @@ var emojiProcessors = []processor{
183
183
emojiProcessor ,
184
184
}
185
185
186
- // RenderCommitMessageSubject will use the same logic as PostProcess and
187
- // RenderCommitMessage , but will disable the shortLinkProcessor and
186
+ // PostProcessCommitMessageSubject will use the same logic as PostProcess and
187
+ // PostProcessCommitMessage , but will disable the shortLinkProcessor and
188
188
// emailAddressProcessor, will add a defaultLinkProcessor if defaultLink is set,
189
189
// which changes every text node into a link to the passed default link.
190
- func RenderCommitMessageSubject (ctx * RenderContext , defaultLink , content string ) (string , error ) {
190
+ func PostProcessCommitMessageSubject (ctx * RenderContext , defaultLink , content string ) (string , error ) {
191
191
procs := []processor {
192
192
fullIssuePatternProcessor ,
193
193
comparePatternProcessor ,
@@ -211,40 +211,45 @@ func RenderCommitMessageSubject(ctx *RenderContext, defaultLink, content string)
211
211
return postProcessString (ctx , procs , content )
212
212
}
213
213
214
- // RenderIssueTitle to process title on individual issue/pull page
215
- func RenderIssueTitle (ctx * RenderContext , title string ) (string , error ) {
216
- // do not render other issue/commit links in an issue's title - which in most cases is already a link.
214
+ // PostProcessIssueTitle to process title on individual issue/pull page
215
+ func PostProcessIssueTitle (ctx * RenderContext , title string ) (string , error ) {
217
216
return postProcessString (ctx , []processor {
217
+ issueIndexPatternProcessor ,
218
+ commitCrossReferencePatternProcessor ,
219
+ hashCurrentPatternProcessor ,
218
220
emojiShortCodeProcessor ,
219
221
emojiProcessor ,
220
222
}, title )
221
223
}
222
224
223
- func postProcessString (ctx * RenderContext , procs []processor , content string ) (string , error ) {
224
- var buf strings.Builder
225
- if err := postProcess (ctx , procs , strings .NewReader (content ), & buf ); err != nil {
226
- return "" , err
227
- }
228
- return buf .String (), nil
229
- }
230
-
231
- // RenderDescriptionHTML will use similar logic as PostProcess, but will
225
+ // PostProcessDescriptionHTML will use similar logic as PostProcess, but will
232
226
// use a single special linkProcessor.
233
- func RenderDescriptionHTML (ctx * RenderContext , content string ) (string , error ) {
227
+ func PostProcessDescriptionHTML (ctx * RenderContext , content string ) (string , error ) {
234
228
return postProcessString (ctx , []processor {
235
229
descriptionLinkProcessor ,
236
230
emojiShortCodeProcessor ,
237
231
emojiProcessor ,
238
232
}, content )
239
233
}
240
234
241
- // RenderEmoji for when we want to just process emoji and shortcodes
235
+ // PostProcessEmoji for when we want to just process emoji and shortcodes
242
236
// in various places it isn't already run through the normal markdown processor
243
- func RenderEmoji (ctx * RenderContext , content string ) (string , error ) {
237
+ func PostProcessEmoji (ctx * RenderContext , content string ) (string , error ) {
244
238
return postProcessString (ctx , emojiProcessors , content )
245
239
}
246
240
241
+ func postProcessString (ctx * RenderContext , procs []processor , content string ) (string , error ) {
242
+ var buf strings.Builder
243
+ if err := postProcess (ctx , procs , strings .NewReader (content ), & buf ); err != nil {
244
+ return "" , err
245
+ }
246
+ return buf .String (), nil
247
+ }
248
+
247
249
func postProcess (ctx * RenderContext , procs []processor , input io.Reader , output io.Writer ) error {
250
+ if ! ctx .usedByRender && ctx .RenderHelper != nil {
251
+ defer ctx .RenderHelper .CleanUp ()
252
+ }
248
253
// FIXME: don't read all content to memory
249
254
rawHTML , err := io .ReadAll (input )
250
255
if err != nil {
0 commit comments