arminveres / md-pdf.nvim

Preview markdown files and convert to PDF inside Neovim!
59 stars 4 forks source link

Is there a way to specify the font family? #13

Closed bertradio closed 1 month ago

bertradio commented 1 month ago

I like sans serif fonts. An option to set the font family would be useful.

Thanks

arminveres commented 1 month ago

Hi there, that's a fair point and valid use-case. I will open a PR for it as soon as I am able to, thanks!

arminveres commented 1 month ago

@bertradio you should be now able to change your font and pass custom arguments if necessary, enjoy!

bertradio commented 1 month ago

Thanks. But when I add the code in the README I get this error:

On Thu, May 16, 2024, at 19:36, Armin Veres wrote:

@bertradio https://github.com/bertradio you should be now able to change your font and pass custom arguments if necessary, enjoy!

— Reply to this email directly, view it on GitHub https://github.com/arminveres/md-pdf.nvim/issues/13#issuecomment-2115836936, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALLYYRMA4KTZE2IIEFURHUDZCTVDJAVCNFSM6AAAAABHXUJ5ZGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJVHAZTMOJTGY. You are receiving this because you were mentioned.Message ID: @.***>

arminveres commented 1 month ago

@bertradio can you provide the exact snippet you used? TIA

bertradio commented 1 month ago

No matter what I try and convert I get the same result.

Here is a simple test file that generates the error I sent.

On Thu, May 16, 2024, at 21:03, Armin Veres wrote:

@bertradio https://github.com/bertradio can you provide the exact snippet you used? TIA

— Reply to this email directly, view it on GitHub https://github.com/arminveres/md-pdf.nvim/issues/13#issuecomment-2115988873, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALLYYRIWJLVKINS56KK2D3DZCT7HRAVCNFSM6AAAAABHXUJ5ZGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJVHE4DQOBXGM. You are receiving this because you were mentioned.Message ID: @.***>

bertradio commented 1 month ago

-- markdown-pdf.lua

-- Makes pdf from md file and displays in Okular

-- Created: 05/10/24

My_map('n', ',', function() require("md-pdf").convert_md_to_pdf() end, { desc = 'Markdown pdf preview' })

return { 'arminveres/md-pdf.nvim', branch = 'main', -- you can assume that main is somewhat stable until releases will be made opts = { -- no table of contents toc = false, -- set code highlighting highlight = 'pygments', -- Specify font, nil uses the default font of the theme -- fonts = nil, -- or, where all or only some options can be specified. NOTE: those that are nil can be left -- out completely fonts = { main_font = nil, sans_font = "DejaVuSans", mono_font = "IosevkaTerm Nerd Font Mono", math_font = nil, }, -- Custom options passed to pandoc CLI call, can be ignored for setup pandoc_user_args = nil, -- or -- pandoc_user_args = { -- -- short -- "-V KEY[:VALUE]", -- -- long options -- "--standalone=false", -- }, }, }

On Thu, May 16, 2024, at 21:03, Armin Veres wrote:

@bertradio https://github.com/bertradio can you provide the exact snippet you used? TIA

— Reply to this email directly, view it on GitHub https://github.com/arminveres/md-pdf.nvim/issues/13#issuecomment-2115988873, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALLYYRIWJLVKINS56KK2D3DZCT7HRAVCNFSM6AAAAABHXUJ5ZGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJVHE4DQOBXGM. You are receiving this because you were mentioned.Message ID: @.***>

arminveres commented 1 month ago

@bertradio Yeah the issue seems to be with you copying all of the examples, while they are duplicated, see comments, to show the different ways to set them up. Try this:


{
    'arminveres/md-pdf.nvim',
    keys = {
        {
            "<leader>,",
            function() require("md-pdf").convert_md_to_pdf() end,
            desc = "Markdown preview",
        },
    },
    opts = {
        fonts = {
            main_fonts = "DejaVuSans" -- or whatever you prefer
        }
    },
}

Also try to add the exact error you were getting, otherwise it's hard for me to debug.

bertradio commented 1 month ago

Here's what I have: return {

'arminveres/md-pdf.nvim', keys = { { ",", function() require("md-pdf").convert_md_to_pdf() end, desc = "Markdown preview", }, }, opts = { fonts = { main_fonts = "DejaVuSans" -- or whatever you prefer_width } },

}

And this is the nvim error

On Fri, May 17, 2024, at 10:19, Armin Veres wrote:

@bertradio https://github.com/bertradio Yeah the issue seems to be with you copying all the examples, while they are duplicating, see comments, to show the different ways to set them up. Try this:

{ 'arminveres/md-pdf.nvim', keys = { { ",", function() require("md-pdf").convert_md_to_pdf() end, desc = "Markdown preview", }, }, opts = { fonts = { main_fonts = "DejaVuSans" -- or whatever you prefer } }, } Also try to add the exact error you were getting, otherwise it's hard for me to debug.

— Reply to this email directly, view it on GitHub https://github.com/arminveres/md-pdf.nvim/issues/13#issuecomment-2117004787, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALLYYROLFPUFL6ELLHAASM3ZCW4P7AVCNFSM6AAAAABHXUJ5ZGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJXGAYDINZYG4. You are receiving this because you were mentioned.Message ID: @.***>

arminveres commented 1 month ago

You still did not provide the error.

bertradio commented 1 month ago

I had put it in the email as an inline image. Attached is the file.

On Fri, May 17, 2024, at 12:58, Armin Veres wrote:

You still did not provide the error.

— Reply to this email directly, view it on GitHub https://github.com/arminveres/md-pdf.nvim/issues/13#issuecomment-2117320258, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALLYYRIEOJRLWKR2SB7CTQLZCXPHDAVCNFSM6AAAAABHXUJ5ZGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJXGMZDAMRVHA. You are receiving this because you were mentioned.Message ID: @.***>

arminveres commented 1 month ago

I can honestly not see any attachment - yes I looked in my mail -. Can you copy the text or paste the image into GitHub?

bertradio commented 1 month ago

Here's the error I'm getting:

md-pdf: Error producing PDF. ! Font \TU/lmr/m/n/10=[lmroman10-regular:+tlig; at 10pt not loadable: metric data not found or bad

relax 1.112 ...lt\familydefault\seriesdefault\shapedefault I am running Nvim 0.10 (latest release version) under Linux Debian 12 on a Chromebook via the Crostini VM. On Fri, May 17, 2024, at 14:00, Armin Veres wrote: > > > I can honestly not see any attachment. Can you copy the text or paste the image into GitHub? > > > — > Reply to this email directly, view it on GitHub , or unsubscribe . > You are receiving this because you were mentioned.Message ID: ***@***.***> >
arminveres commented 1 month ago

That looks like a font error coming from pandoc itself; try different fonts or try finding the correct name. Good luck!