chiphuyen / ml-interviews-book

https://huyenchip.com/ml-interviews-book/
3.24k stars 495 forks source link

Enable Export to PDF / EPUB / MOBI #7

Open public-daniel opened 3 years ago

public-daniel commented 3 years ago

When attempting to export to PDF, I got an error. It looks like MathJAX-Node dependency is using a deprecated API. This will probably get resolved upstream, but just in case anyone else wants to export, there is a workaround:

Modify node_modules/mathjax-node/lib/mj-single.js on line 540 from

result.speakText = speech.processExpression(result.mml);

to

result.speakText = speech.toSpeech(result.mml);

Source for workaround: https://github.com/kgryte/tex-equation-to-svg/issues/2#issuecomment-411023604

Command for exporting:

npx honkit pdf ./ ./ml-interviews-book.pdf or npx honkit epub ./ ./ml-interview-book.epub

mikhaildubov commented 3 years ago

Hi @public-daniel, would you mind sharing the PDF you got? Doesn't work for me even with the fix above. Thanks

BellmannRichard commented 3 years ago

@public-daniel what about sharing the PDF? Thanks!

animesh-007 commented 3 years ago

Hi,

PFA for the pdf version of the book. I hope the authors of the book have no issue with this.😓 Thank you @Aryaman1706 for helping me in converting to the pdf version.

Regards, Animesh ml-interviews-book.pdf

chiphuyen commented 2 years ago

Hi @animesh-007, this is amazing. I just sent you an email with a follow-up question about PDF rendering. Thank you so much!

Hi,

PFA for the pdf version of the book. I hope the authors of the book have no issue with this.😓 Thank you @Aryaman1706 for helping me in converting to the pdf version.

Regards, Animesh ml-interviews-book.pdf

animesh-007 commented 2 years ago

ml-interviews-book.pdf

Hi @chiphuyen. I tried to answer your follow-up question in the email. Hope the problem is resolved now. 😇

chiphuyen commented 2 years ago

Thanks Animesh! Yep we're working on it, just some few formatting problems left!

ml-interviews-book.pdf

Hi @chiphuyen. I tried to answer your follow-up question in the email. Hope the problem is resolved now. 😇

karelin commented 1 year ago

hello all, Is it possible to provide some clues how the book in PDF or EPUB can be created? (libraries, tools, ...)

IanQS commented 1 year ago

@animesh-007

Is the url you posted up-to-date? If not could you post instructions as to how you generated it? I'd really appreciate it

jordandraper commented 11 months ago

@animesh-007

Is the url you posted up-to-date? If not could you post instructions as to how you generated it? I'd really appreciate it

Here is a ml-interviews-book.pdf I just generated from the most recent commit. The instructions provided by @public-daniel still work perfectly https://github.com/chiphuyen/ml-interviews-book/issues/7#issue-930765633.

dsvolkov commented 11 months ago

And here is a recent ml-interview-book.epub

goyalyashpal commented 1 month ago
$ npm install
npm warn deprecated har-validator@5.1.5: this library is no longer supported
npm warn deprecated abab@1.0.4: Use your platform's native atob() and btoa() methods instead
npm warn deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be p
roblematic.  See https://v8.dev/blog/math-random for details.
npm warn deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

$ npx honkit pdf ./ ./ml-interviews-book.pdf
Need to install the following packages:
honkit@5.1.4
Ok to proceed? (y) y

npm warn deprecated try-resolve@1.0.1: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
(node:9508) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
ReferenceError: Failed to load HonKit's plugin module: "mathjax" is not found.

cwd: ...\ml-interviews-book-master
baseDir:

    at PluginResolver.resolvePluginPackageName (%LOCALAPPDATA%\npm-cache\_npx\8ad405cc3f853826\node_modules\honkit\lib\plugins\PluginResolver.js:78:19)
    at %LOCALAPPDATA%\npm-cache\_npx\8ad405cc3f853826\node_modules\honkit\lib\plugins\loadForBook.js:26:34
    at %LOCALAPPDATA%\npm-cache\_npx\8ad405cc3f853826\node_modules\immutable\dist\immutable.js:3016:46
    at List.__iterate (%LOCALAPPDATA%\npm-cache\_npx\8ad405cc3f853826\node_modules\immutable\dist\immutable.js:2206:13)
    at mappedSequence.__iterateUncached (%LOCALAPPDATA%\npm-cache\_npx\8ad405cc3f853826\node_modules\immutable\dist\immutable.js:3015:23)
    at seqIterate (%LOCALAPPDATA%\npm-cache\_npx\8ad405cc3f853826\node_modules\immutable\dist\immutable.js:604:16)
    at IndexedSeq.__iterate (%LOCALAPPDATA%\npm-cache\_npx\8ad405cc3f853826\node_modules\immutable\dist\immutable.js:320:14)
    at IndexedIterable.toArray (%LOCALAPPDATA%\npm-cache\_npx\8ad405cc3f853826\node_modules\immutable\dist\immutable.js:4258:23)
    at List [as constructor] (%LOCALAPPDATA%\npm-cache\_npx\8ad405cc3f853826\node_modules\immutable\dist\immutable.js:2065:62)
    at reify (%LOCALAPPDATA%\npm-cache\_npx\8ad405cc3f853826\node_modules\immutable\dist\immutable.js:3570:37)