Skip to content

Draft: Allow embedding of code in Markdown

Heinrich Lee Yu requested to merge 300855-embed-code-in-markdown into master

What does this MR do and why?

Todo

  • Limit rendering of blob content
    • Only render when link href is the same as link text
    • Only render when link is at the end of line
    • Validate that the given start and end line numbers are correct
    • Only render when selected blob content is less than certain size or number of lines
    • Don't render blob content when inside lists, bold, italic, strikethrough
    • Skip binary blobs
    • Only render at most 3 (?) links per Markdown field
  • Performance: Batch load projects / blobs
  • Security
    • Redact blob content when user does not have access
    • Don't send blob content in email notifications when show_diff_preview_in_email is disabled. Or maybe just disable this in emails all the time as a first iteration.
  • Frontend
    • Render syntax highlighted blob content with file information / SHA
    • Add project name if cross-project reference. Or maybe we can skip rendering in this case too?
    • Add max height and make it scrollable
    • Investigate why syntax highlighting colors are different from file viewer
    • Fix copy-paste behavior
    • Check if JS behavior is needed, like highlighting lines when line number is clicked

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #300855

Edited by Heinrich Lee Yu

Merge request reports