Closed iNerdStack closed 1 month ago
Hi, @iNerdStack ! Thanks for bringing this to my attention!
You're absolutely right! Now that you mention it, it does make sense. It seems like a good approach to place a method for creating the renderContext in outputGenerate, and then pass this renderContext to each generate method. Taking it a step further, we could even consider having xmlStyle.ts and others just return the template, and then do the actual rendering in outputGenerate.
Exactly, that's what I was thinking too. Can you assign me to this, and I can make a proposed PR or you can work that out?
@iNerdStack If you have the time, I’d really appreciate it! Thank you, I’ll go ahead and assign this to you.
Thank you for addressing this issue. If there are no further concerns, I'll go ahead and close this.
I realized that caching the compiled templates could lead to further optimization, so I've created a PR for this.
That's good, Its all good now. Thank you for accepting my changes
I really appreciate your work on this. I'll go ahead and close this issue now.
Please don't hesitate to reach out if you have any more ideas or suggestions in the future!
The renderContext was repeated in all three style generation files including the logic to generate
/src/core/output/outputStyles/plainStyle.ts
/src/core/output/outputStyles/xmlStyle.ts
/src/core/output/outputStyles/markdownStyle.ts
Proposed Solution
Move the common logic in these files into a shared utility file. This will make it easier to maintain as you add new styles and also add new parameters for renderContext in the future