GithubHelp home page GithubHelp logo

Comments (5)

Zivaga avatar Zivaga commented on May 21, 2024 1

:) Sure. I will use it in a more scripted way very soon. If I think about ant improvement, I'll let you know.

Thanks!

from md-to-pdf.

simonhaenisch avatar simonhaenisch commented on May 21, 2024

The related code is here:

md-to-pdf/index.js

Lines 83 to 90 in b83e9f1

// merge config from config file
if (args['--config-file']) {
try {
config = { ...config, ...require(path.resolve(args['--config-file'])) };
} catch (error) {
console.warn(chalk.red(`Warning: couldn't read config file: ${args['--config-file']}`));
}
}

I don't have access to a Windows machine right now, I'll look into it when I get access to one. Anyway, I'm not sure why path.resolve() would not work here... it's just supposed to take the relative path and make it absolute, relative to the current working directory.

Can you try running this in your directory and see if it works (i. e. prints your config), please:

node -e "console.log(require(path.resolve('generate-pdf\config.json')))"

Update: I just released 2.3.1 which allows to log any errors that occur while trying to read the config file, if you pass the --debug argument. Can you please download the latest version and let me know what error it logs when running

md2pdf --debug --config-file generate-pdf\config.json doc1\doc1.md

The issue is not necessarily related to not being able to find/read the file, but e. g. could also be due to a syntax error within the file (maybe a trailing comma?).

from md-to-pdf.

Zivaga avatar Zivaga commented on May 21, 2024

Shame on me... I mistyped the folder (generate-pdf instead of generate_pdf .... dash/underscore issue).

In fact, it works like a charm!

I'm really sorry for the not-real-issue.... (the issue where between the chair and the keyboard...) :-/

from md-to-pdf.

simonhaenisch avatar simonhaenisch commented on May 21, 2024

No worries, glad you could figure it out 🤓 I haven't thoroughly tested all the different options myself and only on macOS, so I'm thankful for any feedback on potential issues. Gives me a chance to improve the code 😉

from md-to-pdf.

nekloth avatar nekloth commented on May 21, 2024

Hi

The relative path changed... it used to consider the relative path from the execution path, now, it considers relative path from the MD file.

It used to work with:

  "stylesheet": [
    ".\\mystyle.css"
  ],

when executed from c:\RepoFolderRoot\

Error is:

 md2pdf --config-file .\generate_pdf\config.json ./doc1/doc1.md
  × generating PDF from ./doc1/doc1.md
    → ENOENT: no such file or directory, open 'c:\RepoFolderRoot\doc1\mystyle.css'

and now works with...

  "stylesheet": [
    "C:\\RepoFolderRoot\\generate_pdf\\mystyle.css"
  ],

It is not very convenient for me, as my stylesheet lifecyle is different from doc lifecycle, and I'm not the only one to use this repo (and of course, all of us do not have the same folder organisation....)

from md-to-pdf.

Related Issues (20)

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.