Giter VIP home page Giter VIP logo

magicbook's People

Contributors

dependabot[bot] avatar jasongao97 avatar joeyklee avatar kant avatar leafac avatar runemadsen avatar shiffman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

magicbook's Issues

needs assessment wrt Nature of Code 2.0?

I've done some perusing as far as current digital publishing platform options but it occurs to me rather than a broad write up perhaps it would be best if there were a rudimentary needs assessment of some kind vis a vis Magic Book as it pertains to @shiffman 's Nature of Code overhaul?

what exactly are the short term, mid term, and long term requirements for Magic Book as dictated by NOC v2.0?

@joeyklee mentioned first and foremost is getting chapter 10 ready for the upcoming IMA course in Fall 2019 but to what extent, if any, is that dependent upon further development work on Magic Book?

there was mention of porting Nature of Code content to Markdown; ability to generate an index from Markdown; and ePub + Mobi output. roughly where do those fall in terms of timeline and priority?

is there a roadmap of some kind beyond the most recent version of TODO.md, now three years old?

if not, perhaps a rudimentary Project board for the Magic Book repo might be a worth while exercise?

Two html/body

Hello,
I saw a second <html><head></head><body> on the example build, in html example.

 <div class="container">
	<html><head></head><body><section data-type="chapter" id="html-chapter-8vy0FZP">
	<h1>HTML Chapter</h1>
	<p id="second-chapter-id">This is a chapter written in HTML</p>
	</section></body></html>
</div>

I would like to remove this but I don't know where to start to looking for?
Maybe I'm not the only one to have this?
Thanks for your help!

HTML build fails without error

I've been running magicbook in the same setup for a few months (Obsidian + Magicbook), but it suddenly stopped working. The command will complete without error, but the HTML files are no longer built and there is no error:

Config file detected: magicbook.json
(node:25216) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

(The Buffer() warning hasn't appeared to affect the success of the build before)

Occasionally the deletion of a file will cause the build to succeed.

Is there a way to get a log of why the HTML build might be failing?

Math Formula

I've read the section in the README about math with latex + katex. Just opening an issue to track the status. Should math formula render in either PDF or HTML now or not yet?

automatic date

In my book the title page says:

<p>version 2.0 alpha, generated July 13, 2016</p>

I would love to be able to auto-generate the date. There is probably also something interesting in terms of auto rendering the most recent commit hash or git tag or something, but this is certainly not a high priority.

image files are not found on Windows

When images are stored in subfolders, on Windows the build returns messages like:

image not found in source folder: chapter10/ch10_exc05.png

This is happening when I try to build the book The Nature of Code 2.

I found that the problems stems to having the source attribute correctly set as:

src="chapter10/ch10_exc05.png"

but incorrectly matched against the ImageMap which stores the same entry using a similar but different key (with backslash)

chapter10\ch10_exc05.png

Shortly I'll propose a PR shortly to fix the issue.

Duplicated auto-generated IDs

I'm having an error that I can't figure out. I have several instances of <data-type="tip"></div> in my book (one per chapter actually). During the build process these get turned into:

<div data-type="tip" id="the-ecosystem-project-wpBck">

I've determined that if I ever build the book with more than 5 chapters, I get an error due to a duplicated ID, like somehow the wpBck has been generated twice. I am not sure if there is a magic book bug or a bug in my markup.

I am going to investigate this more by making some dummy, test files.

Different files for different builds

This is a small thing and might only come up rarely, but I have an HTML file that I want to include for my HTML build, but not for my PDF build. Right now there is only one files array in magicbook.json which is separate from the builds array.

More detailed PrinceXML error messages

I'm trying to get more detail about a PrinceXML error. What about a "verbose" build argument to grab the output of callback(error)?

      Prince()
        .inputs(path.join(extras.destination, "consolidated.html"))
        .output(path.join(extras.destination, "consolidated.pdf"))
        .execute()
        .then(function () {
          callback(null, config, stream, extras);
        }, function (error) {
          console.log("Prince XML error")
          callback(error);
        });
    });

console.log("Prince XML error")

Fonts

What's the best way to approach custom fonts? For example, I have a CSS file like so:

 @font-face {font-family: 'ProximaNovaS-Thin';src: url('../fonts/23AC3F_3_0.eot');src: url('../fonts/23AC3F_3_0.eot?#iefix') format('embedded-opentype'),url('../fonts/23AC3F_3_0.woff') format('woff'),url('../fonts/23AC3F_3_0.ttf') format('truetype');}

Then I have the font files themselves in:

noc_pdf/fonts/

Should we add something similar to how images work to move those files into assets?

"fonts" : {
  "source" : "/noc_pdf/fonts/"
}

Table of Contents Questions

I've read the TOC section in the README and have some questions / clarification.

This is what I have:

includes/toc.html:

<nav data-type='toc'>
  <h1>Table of Contents</h1>
  <ol>
    {% include toc_item.html children=toc.children %}
  </ol>
</nav>

toc.html:

<section data-type="toc" id="_toc">
{{TOC}}
</section>

chapter1.html:

<section data-type="chapter">
content
</section>

The README makes reference to:

{
  id: "#id-of-the-section",
  type: "Type of HTMLBook section",
  label: "Title for section",
  children: [] // array of child sections
}

But I'm not exactly sure where the above should go and how it should be formed / related to data-type="chapter">.

Does my question make sense?

Custom image directory

I'm trying to sort out the best way to organize my image files. I currently have:

noc_pdf/images/intro/intro_ex01.png
noc_html/images/intro/intro_ex01.png

Then in my book I have:

<img alt="intro ex01" src="intro/intro_ex01.png" />

An in magicbook.json

         "images" : {
            "source" : "/noc_pdf/imgs/"
         }

The images show up but only if I actually write "assets" into my html source itself i.e.:

<img alt="intro ex01" src="assets/intro/intro_ex01.png" />

From what I understand magic book should add "assets" in dynamically when it generates "consolidated.html" on the way to making the PDF. But this doesn't seem to be happening.

magicbook command not found

(base) MacBook-Pro:projects vignesh$ magicbook new myproject
-bash: magicbook: command not found

getting this error on mac despite installing with 'npm install magicbook -g'

help is appreciated

[Solved] Error in installation

I have this error in a clean installation.


Steps

➜ MINIZINC cd magicbook
➜ magicbook ls
➜ magicbook npm install magicbook -g
/usr/local/bin/magicbook -> /usr/local/lib/node_modules/magicbook/src/index.js

[email protected] install /usr/local/lib/node_modules/magicbook/node_modules/fsevents
node install

[fsevents] Success: "/usr/local/lib/node_modules/magicbook/node_modules/fsevents/lib/binding/Release/node-v51-darwin-x64/fse.node" is installed via remote

[email protected] install /usr/local/lib/node_modules/magicbook/node_modules/node-sass
node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v3.13.1/darwin-x64-51_binding.node
Download complete ⸩ ⠋ :
Binary saved to /usr/local/lib/node_modules/magicbook/node_modules/node-sass/vendor/darwin-x64-51/binding.node
Caching binary to /Users/Salazar/.npm/node-sass/3.13.1/darwin-x64-51_binding.node

[email protected] install /usr/local/lib/node_modules/magicbook/node_modules/prince
node ./prince-npm.js install

++ checking for globally installed PrinceXML
++ downloading PrinceXML distribution
-- download: http://www.princexml.com/download/prince-11.3-macosx.tar.gz
-- download: [########################################] 100% (ETA: 0.0s)
-- download: 7031296 bytes received.
++ locally unpacking PrinceXML distribution
# ERROR: failed to extract: TypeError: tar.Extract is not a function

[email protected] postinstall /usr/local/lib/node_modules/magicbook/node_modules/node-sass
node scripts/build.js

Binary found at /usr/local/lib/node_modules/magicbook/node_modules/node-sass/vendor/darwin-x64-51/binding.node
Testing binary
Binary is fine
/usr/local/lib
└─┬ [email protected]
├── [email protected]
├─┬ [email protected]

...
...
➜ magicbook magicbook new minizinc-es
Created folder: minizinc-es
➜ magicbook cd minizinc-es
➜ minizinc-es magicbook build
Config file detected: magicbook.json
/usr/local/lib/node_modules/magicbook/node_modules/prince/prince-api.js:242
throw new Error("Prince#" + method + ": cannot resolve binary "" +
^

Error: Prince#execute: cannot resolve binary "prince" to a filesystem path
at Prince._execute (/usr/local/lib/node_modules/magicbook/node_modules/prince/prince-api.js:242:19)
at Prince.execute (/usr/local/lib/node_modules/magicbook/node_modules/prince/prince-api.js:298:17)
at DestroyableTransform. (/usr/local/lib/node_modules/magicbook/src/plugins/pdf.js:51:10)
at emitNone (events.js:91:20)
at DestroyableTransform.emit (events.js:188:7)
at finishMaybe (/usr/local/lib/node_modules/magicbook/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:607:14)
at afterWrite (/usr/local/lib/node_modules/magicbook/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:470:3)
at onwrite (/usr/local/lib/node_modules/magicbook/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:461:7)
at WritableState.onwrite (/usr/local/lib/node_modules/magicbook/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:169:5)
at afterTransform (/usr/local/lib/node_modules/magicbook/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:104:3)

Index terms markup

There is probably a larger discussion to have, but I've found that the ASCIIDOC to HTMLBook conversion for NOC resulted in the following:

<p><a data-primary="random walks" data-type="indexterm">&nbsp;</a></p>

<p>CONTENT</p>

This markup leaves blank paragraphs and extra spacing in the book. I could do a global replace like:

<a data-primary="random walks" data-type="indexterm"></a>

<p>CONTENT</p>

But then these index terms are floating. What is the proper markup? Do I need them to just be moved and embedded into actual paragraphs?

<p><a data-primary="random walks" data-type="indexterm"></a> CONTENT</p>

Is the &nbsp; necessary?

See: https://github.com/shiffman/The-Nature-of-Code/blob/master/chapters/00_7_intro.html#L17

Do not end process on failure when watching

When doing magicbook build --watch, creating an error will end the program - when really it should stay alive, perhaps alerting users through a terminal bell or a notification (If supported)

Not installing

On my manjaro linux machine it isn't installing. Getting error like this,

Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/magicbook/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: node scripts/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-04-10T18_09_31_019Z-debug.log

magicbook serve command

Some way to automatically serve the HTML builds live in the browser with watch functionality.

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.