GitBook 제작 전자 책 상세 강좌
8487 단어 gitbook전자 책gitbook 명령
https://nodejs.org/#download
node.js 소스 코드 다운로드(녹색 INSTALL 클릭),스트레스 를 풀다
./configure
make
make install
성공 적 으로 실행 한 후 npm 가 설치 되 었 습 니 다.2.gitbook 설치 명령
npm install -g gitbook-cli
gitbook -V
gitbook 이 설치 되 었 는 지 확인 합 니 다.ref
===
1. wanqingwong.com/gitbook-zh/index.html
gitbook 사용
===========
1.목록 에 따라 도서 구조 생 성
1.1 README.md 와 SUMMARY 작성
README.md
이 파일 은 Gitbook 의 프로필 에 해당 합 니 다.
$ mkdir test_gitbook
$ touch README.md
SUMMARY.md이 파일 은 책의 디 렉 터 리 구조 로 Markdown 문법 을 사용 합 니 다.
우리 이 책의 SUMMARY.md:
$ touch SUMMARY.md
$ vim SUMMARY.md
입력*[프로필](README.md)
*[제1장](chapter 1/README.md)
- [1 절](chapter 1/section 1.md)
- [2 절](chapter 1/section 2.md)
*[제2 장](chapter 2/README.md)
- [1 절](chapter 2/section 1.md)
- [2 절](chapter 2/section 2.md)
*[종료](end/README.md)
1.2 도서 구조 생 성
이 디 렉 터 리 파일 이 만들어 지면 Gitbook 을 사용 할 수 있 습 니 다.
명령 행 도 구 는 이 디 렉 터 리 구 조 를 해당 하 는 디 렉 터 리 와 파일 로 만 듭 니 다.
$ gitbook init
$ tree . #
├── chapter1│ ├── README.md
│ ├── section1.md
│ └── section2.md
├── chapter2
│ ├── README.md
│ ├── section1.md
│ └── section2.md
├── end
│ └── README.md
├── README.md
└── SUMMARY.md
gitbook 이 SUMMARY.md 와 생 성 된 것 을 볼 수 있 습 니 다.
대응 하 는 디 렉 터 리 와 파일.
디 렉 터 리 마다 한 장의 설명 에 해당 하 는 README.md 파일 이 있 습 니 다.
2.도서 생 성
2.1 정적 사이트 로 출력
정적 사 이 트 를 출력 하 는 두 가지 방법 이 있 습 니 다.
2.1.1 로 컬 미리 보기 시 자동 생 성
컴퓨터 에서 책 을 편집 한 후에 Gitbook 을 사용 할 수 있 습 니 다.
로 컬 미리 보기 명령 줄:
$ gitbook serve .
그리고 브 라 우 저 에 입력:
http://localhost:4000
이렇게 하면 미리 보기 생 이 됩 니 다.홈 페이지 로 구 성 된 책.
여기 서 당신 은 도서 항목 의 목록 에 이름 이 하나 더 있 는 것 을 발견 할 수 있 을 것 입 니 다.
_북 의 파일 디 렉 터 리,이 디 렉 터 리 의 파일,즉 생 성 된 정적
사이트 내용.
build 매개 변 수 를 사용 하여 지정 한 디 렉 터 리 에 생 성 합 니 다.
직접 미리 보기 로 생 성 된 정적 사이트 파일 과 달리 이 명령 을 사용 하면
원 하 는 디 렉 터 리 에 내용 을 입력 할 수 있 습 니 다:
$ mkdir /tmp/gitbook
$ gitbook build --output=/tmp/gitbook
2.2 PDF 출력PDF 파일 로 입력 하려 면 NPM 을 사용 하여 gitbook pdf 를 설치 해 야 합 니 다.
$ sudo npm install gitbook-pdf -g
나 는 위의 명령 을 수행 할 때 아래 의 오류 가 발생 했다.***************************************************
Downloading http://cdn.bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-i686.tar.bz2
Saving to /usr/local/lib/node_modules/gitbook-pdf/node_modules/phantomjs/phantomjs/phantomjs-1.9.7-linux-i686.tar.bz2
Error: connect ETIMEDOUT
at exports._errnoException (util.js:746:11)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19)
npm ERR! Linux 3.2.0-4-686-pae
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "gitbook-pdf" "-g"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node install.js'.
npm ERR! This is most likely a problem with the phantomjs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls phantomjs
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/wangxq/repository/phantomjs/npm-debug.log
***************************************************오류 보고 내용 의 첫 줄 에서 알 수 있 듯 이 오류 가 발생 한 원인 은 다운로드 입 니 다.
phantomjs 에 오류 가 발생 했 기 때문에 수 동 으로 다운로드 하고 설치 해 야 합 니 다.
해결 방법:[1]
$ git clone git://github.com/ariya/phantomjs.git
$ sudo apt-get install build-essential g++ flex bison gperf ruby perl \
libsqlite3-dev libfontconfig1-dev libicu-dev libfreetype6 libssl-dev \
libpng-dev libjpeg-dev python libx11-dev libxext-dev #
$ cd phantomjs
$ git checkout 1.9.7 # : 1.9.7 phantom ,
$ ./build.sh --jobs 4
$ sudo cp bin/phantomjs /bin/
$ sudo npm install gitbook-pdf -g #
그리고 다음 명령 을 사용 하여 PDF 파일 을 사용 하려 면 먼저 의존 라 이브 러 리 를 설치 하 십시오.
$ sudo apt-get install calibre
$ gitbook -v 2.1.0 pdf .
오류 발생:*****************************************************
info: start conversion to pdf ....ERROR
Error: Command failed: /bin/sh -c ebook-convert /tmp/tmp-29384ctltwbk/SUMMARY.html /tmp/tmp-29384ctltwbk/index.pdf --title="" --comments=" gitbook " --language="en" --book-producer="GitBook" --publisher="GitBook" --chapter="descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter ')]" --chapter-mark="pagebreak" --page-breaks-before="/" --level1-toc="descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter-1 ')]" --level2-toc="descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter-2 ')]" --level3-toc="descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter-3 ')]" --no-chapters-in-toc --max-levels="1" --breadth-first --margin-left="62" --margin-right="62" --margin-top="56" --margin-bottom="56" --pdf-default-font-size="12" --pdf-mono-font-size="12" --paper-size="a4" --pdf-header-template="<p class='header'><span></span></p>" --pdf-footer-template="<p class='footer'><span>_SECTION_</span> <span style='float:right;'>_PAGENUM_</span></p>"
Usage: ebook-convert input_file output_file [options]
Convert an ebook from one format to another.
input_file is the input and output_file is the output. Both must be specified as the first two arguments to the command.
The output ebook format is guessed from the file extension of output_file. output_file can also be of the special format .EXT where EXT is the output file extension. In this case, the name of the output file is derived the name of the input file. Note that the filenames must not start with a hyphen. Finally, if output_file has no extension, then it is treated as a directory and an "open ebook" (OEB) consisting of HTML files is written to that directory. These files are the files that would normally have been passed to the output plugin.
After specifying the input and output file you can customize the conversion by specifying various options. The available options depend on the input and output file types. To get help on them specify the input and output file and then use the -h option.
For full documentation of the conversion system see
http://manual.calibre-ebook.com/conversion.html
Whenever you pass arguments to ebook-convert that have spaces in them, enclose the arguments in quotation marks.
ebook-convert: error: no such option: --pdf-default-font-size
*****************************************************해결 방법[2]
$ sudo -v && wget -nv -O- https://raw.githubusercontent.com/kovidgoyal/calibre/master/setup/linux-installer.py | sudo python -c "import sys; main=lambda:sys.stderr.write('Download failed
'); exec(sys.stdin.read()); main()"
$ gitbook -v 2.1.0 pdf . # pdf, book.pdf
ref===
1. http://phantomjs.org/build.html
2. http://calibre-ebook.com/download_linux
문제.===
1.gitbook init 명령 을 입력 하면 Installing version 2.1.0 이 나타 납 니 다.
설치 대기 내성 이 필요 합 니 다.
이상 은 제 가 정리 한 gitbook 의 설치 와 사용 자료 입 니 다.여러분 의 지지 에 감 사 드 립 니 다!
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
GitBook에서 문서를 PDF 내보내기GitBook하여 문서 내보내고 싶어서 여러가지 조사 필요하다고 느낀 정보를 정리 메모 VSCode 터미널 npm으로 설치 서적 언어를 일본어로 다양한 설정이있는 것 같습니다. book.json 실행하여 브라우저에서...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.