Keep a Line Break in a Markdown Table Cell From CSV

CSV can hold a literal newline inside a quoted field, but a Markdown table row occupies a single source line. The linked converter flattens line feeds to spaces. If those line breaks carry meaning, replace them with a marker before conversion.

Worked example

CSV prepared to preserve one cell break

Station,Instructions
A-12,"Check the latch.__LINE_BREAK__Record the reading."

Steps

  1. Within the quoted field, replace the newline with a marker absent from the source data. The example uses __LINE_BREAK__ inside the instructions cell.
  2. Convert the CSV, then replace each marker in the generated Markdown with <br> if the target supports inline HTML. Keep the entire row on one physical line in the Markdown file.
  3. Preview the Markdown. The two steps should display on separate lines inside one cell. If the reader strips HTML, use a separator such as a semicolon or put the steps in a list below the table.

What to check

  • Do not replace all newlines in a CSV file. Only change the intended fields; the newline between records still separates rows.
  • The <br> technique depends on the Markdown renderer and its HTML settings. Check the actual published preview, especially if the output will also be read as plain text.

Convert the prepared CSV before replacing the marker

References