jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.69k stars 3.39k forks source link

Multi-line title breaks groff/ms output #8835

Closed tweedyf closed 1 year ago

tweedyf commented 1 year ago

The problem. The following markdown with YAML header

---
author:
- Albert Krewinkel
- John MacFarlane
date: 'January 10, 2020'
title: |
         A New Approach: 
         Pandoc Lua Filters
---

# Introduction

Pandoc has long supported filters, which allow the pandoc
abstract syntax tree (AST) to be manipulated between the parsing and the writing phase. 

should ideally yield a multi-line title, or else at least a single-line title, as it does (for example) in LaTeX PDF output and reStructuredText output.

However, when the output format is ms, pandoc generates the following (some preamble omitted):

[...]
.\" ***************************************************************
.\" PDF metadata
.pdfinfo /Title "A New Approach: Pandoc Lua Filters"
.pdfinfo /Author "Albert Krewinkel; John MacFarlane"
.hy
.TL
.LP
A New Approach: Pandoc Lua Filters
.AU
Albert Krewinkel
.AU
John MacFarlane
.AU
.sp 0.5
.ft R
January 10, 2020
.\" 1 column (use .2C for two column)
.1C
.SH 1
Introduction
.pdfhref O 1 "Introduction"
.pdfhref M "introduction"
.LP
Pandoc has long supported filters, which allow the pandoc abstract
syntax tree (AST) to be manipulated between the parsing and the writing
phase.
.pdfsync

The inclusion of a .LP command here "within" the title breaks the output when the code is compiled to a pdf using pdfroff (called from within pandoc or separately).

Instead, there should be a .bp command between each of the title YAML elements.

Pandoc command pandoc --from markdown --to ms --standalone

Pandoc version? I encountered this behavior on pandoc 2.19.2 on macOS 13.3.1 22E261 arm64. It reproduces at https://pandoc.org/try/.

pandoc 2.19.2
Compiled with pandoc-types 1.22.2.1, texmath 0.12.5.2, skylighting 0.13,
citeproc 0.8.0.1, ipynb 0.2, hslua 2.2.1
Scripting engine: Lua 5.4
jgm commented 1 year ago

We need to convert the title to inlines. This should be a simple fix.