How can I render colors on `on_stdout` of `jobstart`

I was trying to render the output of glow.
My first approach was using “termopen.” Still, after finishing the process, termopen says [Process Exited 0], and that’s so annoying. My second approach was using jobstart and appending this on a buffer, but it does not render colors victorious. Do you know another way of outputting colors?

This is my code
With termopen

  local width = vim.api.nvim_get_option("columns")
  local height = vim.api.nvim_get_option("lines")
  local win_height = math.ceil(height * 0.8 - 4)
  local win_width = math.ceil(width * 0.8)
  local row = math.ceil((height - win_height) / 2 - 1)
  local col = math.ceil((width - win_width) / 2)

  if glow_width and glow_width < win_width then
    win_width = glow_width
  end

  local opts = {
    style = "minimal",
    relative = "editor",
    width = win_width,
    height = win_height,
    row = row,
    col = col,
    border = glow_border or "shadow",
  }

  -- create preview buffer and set local options
  buf = vim.api.nvim_create_buf(false, true)
  win = vim.api.nvim_open_win(buf, true, opts)
  vim.api.nvim_buf_set_option(buf, "bufhidden", "wipe")
  vim.api.nvim_buf_set_option(buf, "filetype", "glowpreview")
  vim.api.nvim_win_set_option(win, "winblend", 0)
 vim. api.nvim_buf_set_keymap(buf, "n", "q", ":lua require('glow').close_window()<cr>", { noremap = true, silent = true })
  vim.api.nvim_buf_set_keymap(
    buf,
    "n",
    "<Esc>",
    ":lua require('glow').close_window()<cr>",
    { noremap = true, silent = true }
  )

  local use_pager = glow_use_pager and "-p" or ""
  vim.fn.termopen(string.format("print '%s' | %s %s -s %s %s", str, glow_path, use_pager, glow_style, "-"))

With jobstart:

  local width = vim.api.nvim_get_option("columns")
  local height = vim.api.nvim_get_option("lines")
  local win_height = math.ceil(height * 0.8 - 4)
  local win_width = math.ceil(width * 0.8)
  local row = math.ceil((height - win_height) / 2 - 1)
  local col = math.ceil((width - win_width) / 2)

  if glow_width and glow_width < win_width then
    win_width = glow_width
  end

  local opts = {
    style = "minimal",
    relative = "editor",
    width = win_width,
    height = win_height,
    row = row,
    col = col,
    border = glow_border or "shadow",
  }

  -- create preview buffer and set local options
  buf = vim.api.nvim_create_buf(false, true)
  win = vim.api.nvim_open_win(buf, true, opts)
  vim.api.nvim_buf_set_option(buf, "bufhidden", "wipe")
  vim.api.nvim_buf_set_option(buf, "filetype", "glowpreview")
  vim.api.nvim_win_set_option(win, "winblend", 0)
  vim.api.nvim_buf_set_keymap(buf, "n", "q", ":lua require('glow').close_window()<cr>", { noremap = true, silent = true })
  vim.api.nvim_buf_set_keymap(
    buf,
    "n",
    "<Esc>",
    ":lua require('glow').close_window()<cr>",
    { noremap = true, silent = true }
  )

  local use_pager = glow_use_pager and "-p" or ""
  local string_table = vim.split(str, '\n')
  for _, value in pairs(string_table) do
    vim.fn.jobstart(string.format("print '%s' | %s %s -s %s %s", value, glow_path, use_pager, glow_style, "-"), { on_stdout = function (channel_id, data)
      vim.fn.append(vim.fn.line('$'), data)
    end})
  end

no idea what glow is, but to render on the terminal use the variables in $LS_COLORS, if it’s a window use match. If it’s cmdmode output, than you can also use match but extending cmdmode’s built-in hl-groups.

Sorry, but I did not get it. Do you have any examples?
Glow URL: GitHub - charmbracelet/glow: Render markdown on the CLI, with pizzazz! 💅🏻