Skip to content

Question - replace line of text with HTML element #4941

Answered by jerch
x1unix asked this question in Q&A
Discussion options

You must be logged in to vote

The question is whether those images should be shown inline in the terminal, or elsewhere on the html page.

For inline output with intact buffer scrolling the easiest way is prolly to replace your base64 lines with inline image protocol sequences (iTerm's image sequence) and use the image addon, it will automatically show the images inlined at the position of the sequence. For how to shape the sequence, see the protocol spec here https://iterm2.com/documentation-images.html.

For elsewhere on the html page, do the following:

  • grab line content, identify base64 image part
  • create new Image and set src attribute to your base64 string
  • append image to your DOM container elsewhere

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@x1unix
Comment options

@x1unix
Comment options

@jerch
Comment options

@x1unix
Comment options

Answer selected by x1unix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants