Prevent unnecessary Gitaly calls when rendering TODO comment excerpts
If Gitaly is down or degraded it will likely affect the performance of the TODO page, including a 503 if there is a gitaly grpc timout. This is because if TODOs contain certain items, like merge requests, we are making multiple gitaly calls, example:
There is nothing in the TODO summaries that need us to go all the way down to Gitaly and back.
We require Gitaly calls when post-processing Markdown with links to repository files. Even if the link is not on the first line, we still have Gitaly calls because we actually render and post-process the whole comment and then get the first line.
We can get the first line from the rendered Markdown and then do post-processing so that we prevent these unnecessary Gitaly calls. This should also improve performance of the post-processing pipeline because there would be less HTML to post-process.
The same method is used when rendering comment excerpts in the activity feed. So fixing this here would also improve performance for the group / project / user activity feed.