Code Monkey home page Code Monkey logo

mkdocs-pandoc-plugin's People

Contributors

alexandre-perrin avatar haoliuhust avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Forkers

dabukalam

mkdocs-pandoc-plugin's Issues

pdf generated as .pdf.md and attempting to convert pdfs

Hi - I've noticed two problems when running mkdocs build:

  1. Combined pdf is a markdown file called combined.pdf.md
  2. Attempts to convert from pdf files instead of to pdf

Can you suggest anything to fix?

Combined markdown instead of pdf

When I set combined=true, the resulting combined file from mkdocs build is a markdown file that combines all other files, instead of a pdf.

Settings are as below:

plugins:
  - search
  - pandoc:          # requires mkdocs-pandoc-plugin
      # enabled_if_env: ENABLE_PANDOC_EXPORT
      combined: true

Attempts to convert from pdf

There are repeated errors in the terminal like this:

Unknown input format pdf
Pandoc can convert to PDF, but not from PDF.

With combined=true then the combined file is created as a markdown (as above).

If I set combined=false, then no pdf files are created in the subdirectories of mkdocs_site/pandoc.

Missing hint in documentation

I honestly believe that a hint, that the pandoc module needs use_directory_urls on false to work properly would be great.

Without this setting, images are expected in a subdirectory for the page by mkdocs but in the docs directly for pandoc. So either maintain symlinks or two copies of images or ... set this config to false. I think the README should reflect this.

Stale link generated when combined is true.

In plugin.py about line 110 the indentation is wrong. The modify_html-call must be indented one level further to be part of the else-branch. Otherwise, when combined is true, both links will be injected, one being stale as with combined on the individual page-pdfs do not get generated.

Option pandoc_template unrecognised

I've just installed mkdocs-pandoc-plugin and the pandoc_template keyword isn't recognised.

WARNING - Config value 'plugins': Plugin 'pandoc' option 'pandoc_template': Unrecognised configuration name: pandoc_template

My mkdocs.yml settings are as below:

plugins:
  - search
  - pandoc:          # requires mkdocs-pandoc-plugin
      # enabled_if_env: ENABLE_PANDOC_EXPORT
      combined: true
      combined_output_path: pandoc/combined.pdf
      pandoc_template: eisvogel

Combine and Relative Paths

The below reference seems to be where you create the combined md file without taking into account relative path links in the sourced md files. Thus, when the end combined document gets created, the images or relative links will not load. (Specifically I was testing images in md files). I have a multi-level folder structure. I think if you had a fairly basic mkdocs documentation it would not be an issue, or you could strategically place your images to resolve the issue.

I wanted to open this issue to see if this has been thought through.

def write_combined_pandoc(self, output_path: str):
combined_md = output_path + ".md"
with open(combined_md, "w") as f:
for p in self.pages:
if p is None:
log.error("Unexpected error - not all pages were rendered properly")
continue
with open(p, "r") as rf:
lines = rf.readlines()
f.writelines(lines)
if not lines[-1].endswith("\n"):
f.write("\n")
f.write("\n")
self.write_pandoc(combined_md, output_path)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.