Markdown output loses backslashes before pipes and splits rows on carriage returns

Open Beginner friendly
#2,735 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
cli

Research direction

Start with runner.Result.MarkdownRow and the escapeMarkdown implementation mentioned in the issue; the provided Go reproduction exercises both cases without HTTP requests. Check how backslashes and LF are handled, then run the reproduction and render its output as a GitHub Markdown table. Done when the literal backslash is preserved and CR, CRLF, and LF inside cells no longer split a result into extra rows.

Written by the indexing model from the issue text.

Description

Type: Bug
httpx version:

Current dev, 9b6d8077ef7afa119dd6d28eeaf78a6556557acc (Linux amd64, Go 1.27.0). The same escapeMarkdown implementation is in v1.12.0.

Current Behavior:

Markdown output loses literal backslashes before a pipe. A carriage return inside a field can also split one result into two table rows.

For example, a response with title left\|right and <meta name="generator" content="left&#13;right"> produces a title cell with two backslashes before the pipe and leaves the generator's carriage return intact. GitHub's Markdown renderer displays the title as left|right and makes an extra row at the carriage return. Later columns no longer line up with their headings.

Expected Behavior:

Keep the literal backslash in the title and flatten CR/CRLF as well as LF inside table cells, so each result stays on one row.

Steps To Reproduce:

This reproduces the output formatting without making any HTTP requests. From a checkout of current dev, save this as /tmp/httpx-markdown-repro.go and run go run /tmp/httpx-markdown-repro.go:

package main

import (
    "fmt"
    "github.com/projectdiscovery/httpx/runner"
)

func main() {
    r := runner.Result{
        Title: "left\\|right",
        Generator: "left\rright",
        StatusCode: 200,
    }
    fmt.Print(r.MarkdownHeader(), r.MarkdownRow(nil))
}

Render the output as a GitHub Markdown table. The title loses its backslash, and the generator value starts a second row.

Anything else:

I also reproduced this through the CLI against a loopback-only Python HTTP server serving the two fields. Escaping existing backslashes and normalizing CRLF/CR before writing the cell fixes both cases locally. No external targets are needed.

Dominant language
Go
Stars
10.6k
Forks
1.1k
Avg merge
22h 16m
Merged PRs (30d)
24

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from projectdiscovery/httpx

All issues in projectdiscovery/httpx

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.