Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long header will be broken in typst writer #9132

Closed
st1020 opened this issue Oct 13, 2023 · 0 comments
Closed

Long header will be broken in typst writer #9132

st1020 opened this issue Oct 13, 2023 · 0 comments
Labels

Comments

@st1020
Copy link

st1020 commented Oct 13, 2023

Explain the problem.

A very long header will be broken in typst writer.

E.g.

A markdown with a very long header:

# a very very very very very very very very very very very very very very very very very very very very very long header

Use pandoc command:

pandoc t.md -f markdown -t typst -s -o t.typ

The following typst documents will be generated:

= a very very very very very very very very very very very very very
very very very very very very very very long header
<a-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-header>

I used a lua filter to temporarily fix it:

return {
    {
        -- Fix pandoc header error, pandoc will add break line in in very long header
        Header = function(el)
            if FORMAT:match "typst" then
                local text = ""
                for _, i in pairs(el.content) do
                    if i.t == "Str" then
                        text = text .. i.text
                    elseif i.t == "Space" then
                        text = text .. " "
                    end
                end
                return pandoc.RawInline("typst", "#heading(level: " .. el.level .. ")[" .. text .. "]")
            end
        end
    },
}

I think it should be easy to fix, but I don't know Haskell at all so can't help further.

Pandoc version?
version: 3.1.8
os: Darwin Kernel Version 22.6.0

@st1020 st1020 added the bug label Oct 13, 2023
@jgm jgm closed this as completed in c76fbe9 Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant