@@ -159,9 +159,9 @@ func PostProcessDefault(ctx *RenderContext, input io.Reader, output io.Writer) e
159159 return postProcess (ctx , procs , input , output )
160160}
161161
162- // RenderCommitMessage will use the same logic as PostProcess, but will disable
162+ // PostProcessCommitMessage will use the same logic as PostProcess, but will disable
163163// the shortLinkProcessor.
164- func RenderCommitMessage (ctx * RenderContext , content string ) (string , error ) {
164+ func PostProcessCommitMessage (ctx * RenderContext , content string ) (string , error ) {
165165 procs := []processor {
166166 fullIssuePatternProcessor ,
167167 comparePatternProcessor ,
@@ -183,11 +183,11 @@ var emojiProcessors = []processor{
183183 emojiProcessor ,
184184}
185185
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
188188// emailAddressProcessor, will add a defaultLinkProcessor if defaultLink is set,
189189// 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 ) {
191191 procs := []processor {
192192 fullIssuePatternProcessor ,
193193 comparePatternProcessor ,
@@ -211,40 +211,45 @@ func RenderCommitMessageSubject(ctx *RenderContext, defaultLink, content string)
211211 return postProcessString (ctx , procs , content )
212212}
213213
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 ) {
217216 return postProcessString (ctx , []processor {
217+ issueIndexPatternProcessor ,
218+ commitCrossReferencePatternProcessor ,
219+ hashCurrentPatternProcessor ,
218220 emojiShortCodeProcessor ,
219221 emojiProcessor ,
220222 }, title )
221223}
222224
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
232226// use a single special linkProcessor.
233- func RenderDescriptionHTML (ctx * RenderContext , content string ) (string , error ) {
227+ func PostProcessDescriptionHTML (ctx * RenderContext , content string ) (string , error ) {
234228 return postProcessString (ctx , []processor {
235229 descriptionLinkProcessor ,
236230 emojiShortCodeProcessor ,
237231 emojiProcessor ,
238232 }, content )
239233}
240234
241- // RenderEmoji for when we want to just process emoji and shortcodes
235+ // PostProcessEmoji for when we want to just process emoji and shortcodes
242236// 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 ) {
244238 return postProcessString (ctx , emojiProcessors , content )
245239}
246240
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+
247249func 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+ }
248253 // FIXME: don't read all content to memory
249254 rawHTML , err := io .ReadAll (input )
250255 if err != nil {
0 commit comments