Skip to content

- should be escaped as \- in man, but not in ms output #10536

@tkurtbond

Description

@tkurtbond

Discussed in #10533

Originally posted by tkurtbond January 13, 2025
Why does pandoc convert hyphen-minus to minus signs in text when outputing to ms?

For instance, why does running

# Trying out Hyphen-Minus in pandoc -w ms

This is a hyphen-minus, -, which pandoc -w ms turns into a Unicode minus sign.

Use the command ``ls -a`` to see all the dotfiles in a directory.

through

pandoc -r markdown -w ms --output=hyphen-minus.ms  hyphen-minus.md

become

.SH 1
Trying out Hyphen\-Minus in pandoc \-w ms
.pdfhref O 1 "Trying out Hyphen-Minus in pandoc -w ms"
.pdfhref M "trying-out-hyphen-minus-in-pandoc--w-ms"
.LP
This is a hyphen\-minus, \-, which pandoc \-w ms turns into a Unicode
minus sign.
.PP
Use the command \f[CR]ls \-a\f[R] to see all the dotfiles in a
directory.

with all those blasted \-s, which are the troff form for entering a minus sign?

Automagically changing hypen-minus to minus signs is never a good thing to do. It changes the example ls -a command to something that won't work because instead of a hyphen-minus it has a stupid minus sign, which is not the character that introduces an option in a command line program, so the command doesn't work right.

The discussion of thesmart extension in the documents doesn't say anything aobut translating hypen-minus to minus, but I tried -r markdown-smart, which didn't seem to do anything.

$ pandoc --version
pandoc 3.6.2
Features: +server +lua
Scripting engine: Lua 5.4
User data directory: /home/tkb/.pandoc

(Didn't I have this discussion on the old pandoc-discuss mailing list once?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions