GitManual: "<>" are not escaped properly
Closed this issue · 3 comments
Description
Characters "<" and ">" should be escaped not to be confuse with html tags :
For instance in
git branch [--color[=<when>] | --no-color] [-r | -a]\n [--list] [-v [--abbrev=<length> | --no-abbrev]]\n [--column[=<options>] | --no-column]\n [(--merged | --no-merged | --contains) [<commit>]] [--sort=<key>]\n [--points-at <object>] [<pattern>\u2026\u200b]\ngit branch [--set-upstream | --track | --no-track] [-l] [-f] <branchname> [<start-point>]\ngit branch (--set-upstream-to=<upstream> | -u <upstream>) [<branchname>]\ngit branch --unset-upstream [<branchname>]\ngit branch (-m | -M) [<oldbranch>] <newbranch>\ngit branch (-d | -D) [-r] <branchname>\u2026\u200b\ngit branch --edit-description [<branchname>]"
<options>
, <color>
etc are not shown in https://beta.duckduckgo.com/?q=gitbranch
And this breaks the whole html layout (at least on Firefox 66) https://beta.duckduckgo.com/html/?q=gitbranch
Steps to recreate
Open one of those links :
- https://beta.duckduckgo.com/html/?q=gitbranch
- https://beta.duckduckgo.com/?q=gitbranch
- https://duckduckgo.com/html/?q=gitbranch
- https://duckduckgo.com/?q=gitbranch
Instant Answer Page: https://duck.co/ia/view/git_manual
@nheir thanks for reporting.
The missing <when>
, <length>
etc, might be due to the syntax highlighter. I see them in the JSON response we pass to the frontend: https://duckduckgo.com/?q=git+am&t=ffab&ia=web&o=json
The /html breakage is due to the html site's handling of the Fathead data -- it wasn't expecting it to contain HTML tags. We'll be fixing this internally.
DuckDuckHack is currently in maintenance mode though and we're only accepting critical bug reports. I'm not sure this rises to that level so we will have to tolerate this for now.
the json answer also contains valid (and expected) html tags like <section>
or <pre>
.
See
using
<do something>
vs
using raw
<pathspec>