Skip to content

Render blob line of code in GFM

Description

I just noticed this feature on GitHub (taken from this issue):

Rendered Markdown
Screen_Shot_2021-02-02_at_10.33.03_PM Screen_Shot_2021-02-02_at_10.33.17_PM

In GitLab, referencing a blob URL just renders the URL

Rendered Markdown
Screen_Shot_2021-02-02_at_10.37.06_PM Screen_Shot_2021-02-02_at_10.37.11_PM

I copy lines of code a lot in code review and rendering the context of what actually exists in that line would be amazing!

Investigation Notes

Code:

  • This might just be a matter of adding a Banzai Filter (example)

Concerns:

  • Refs whose content can change (i.e. a branch name like master vs. a commit sha)
  • Refs that are not permanent (i.e. what happens if a branch / commit is removed)
  • Viewers permission to view the blob content at the given URL

Questions:

  • Is this something we can just do on the BE?
  • Maybe we want the BE to just set a flag for the FE to kick off something (like mount a Vue component)?
Edited by Paul Slaughter