If you don't want to disable wrapping globally or if John's solution doesn't work for you here is another: My first question would be where these line breaks are introduced. Most probably they existed in the Markdown as SoftBreak elements and got preserved as linebreaks by the stringify function. If you want only space (U+0020) characters in the JSON the easiest way is probably to replace all runs of whitespace with a single space character in the stringified text like so: ````lua local str = pandoc.utils.stringify(span) str = str:gsub('%s+', " ") ```` If that doesn't do it you may want to try to replace SoftBreak and LineBreak elements with Space elements before stringification: ````lua local space_filter = { LineBreak = pandoc.Space, LineBreak = pandoc.Space, } local function stringify_span (span) span = pandoc.walk_inline(span, space_filter) return pandoc.utils.stringify(span) end ```` I'd try postprocessing with string.gsub first since that has less overhead though. I hope this helps! Den ons 9 okt. 2019 18:58Jonas Zohren skrev: > Dear list! > > Setup: > PandocMarkdown transcript of meeting with specially tagged spans. E.g. > > ```md > [Let's declare war on those other guys over there which we don't want to > live.]{.resolution} > > [Let's buy a tank.]{.resolution} > ``` > > I want to extract those resolutions out of the document and store them > as metadata for further processing. I managed to do so with a lua filter > using `pandoc.utils.stringify(span)`. As a result the strings get stored > in metadata: > ```yaml > date: 0000-00-00 > resolutions: > - text: | > Let's declare war on those other guys over there which > we don't want to live on. > > ``` > > And here is my problem: It gets split up into multiple lines, even > though the original text did not have line breaks. In markdown this > wouldn't be a huge problem, as it ignores this, but when I now output > the metadata as json with the template > > ```md > $meta-json$ > ``` > > and `pandoc -t markdown -s` the resulting json contains those line > break, which originally weren't there: > > ```json > {text: "Let's declare war on those other guys over there which\nwe don't > want to live on."} > ``` > > AFAIK PandocMarkdown treats the yaml metadata strings as regular > markdown strings and might auto line break them up as a result, but why > does this leak into the JSON-output? The raw JSON-AST (`pandoc -t JSON`) > does not containt those line breaks. > > How can I avoid that and export my metadata as JSON with _clean_ strings? > > > Kind Regards > > Jonas > > > -- > You received this message because you are subscribed to the Google Groups > "pandoc-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/a2955f67-6668-c9a6-3f46-ff100088759d%40tu-dortmund.de > . > -- You received this message because you are subscribed to the Google Groups "pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhBzur51TULQSiGesXfH%2B3331sHKWzyrdSb5qbA1cVb3zA%40mail.gmail.com.