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

Figure reference links on epub files are wrong #99

Open
gvolpe opened this issue Mar 30, 2022 · 1 comment
Open

Figure reference links on epub files are wrong #99

gvolpe opened this issue Mar 30, 2022 · 1 comment

Comments

@gvolpe
Copy link

gvolpe commented Mar 30, 2022

I am working on a book consisting of 12 markdown files, and I added a first link reference to a figure using pandoc-fignos.

![critical services](img/critical-services.png){#fig:1 width=70%}

*@fig:1 shows a system...

The PDF output is correct, and the figure is linked correctly. However, the epub is pointing to the wrong file. It seems to be getting confused by the files generated by pandoc itself when using --epub-chapter-level=2.

files

Here's a screenshot of the command I use to generate the epub file.

code

Something that is probably relevant, is that I'm using number-sections together with {.unnumbered}. So all the markdown files which names start with 00 are unnumbered. The rest are numbered.

pandoc-fignos seems to count these unnumbered sections and cross-reference the links to them.

Not sure if that's a good assessment of the issue. I'd appreciate any ideas, workarounds, etc.


Versions

$ pandoc --version
pandoc 2.11.4
Compiled with pandoc-types 1.22, texmath 0.12.1.1, skylighting 0.10.4,
citeproc 0.3.0.7, ipynb 0.1.0.1
$ pandoc-fignos --version
pandoc-fignos 2.4.0
@gvolpe
Copy link
Author

gvolpe commented Mar 30, 2022

My current workaround is to disable figure links for epub files, but enable them for pdf files (via latex).

To do so, I disable links on markdown files. E.g.

@fig:id{nolink=True}

And then I apply the following Lua filter when generating the PDF file.

return {
  {
    Str = function (elem)
      if elem.text == "{nolink=True}" then
        return pandoc.Emph {pandoc.Str ""}
      else
        return elem
      end
    end,
  }
}

It is not ideal, but it is at least correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant