This book is pre-configured to produce styling consistent with T-Mobile's style guidelines. Use this book as a template for creating new books. ## To use this book as a template ### 1. Create a copy of the template 1. Login to [https://github.com](https://github.com) 2. Navigate to [https://github.com/GregTMobile/gitbook-prototype3](https://github.com/GregTMobile/gitbook-prototype3) 3. Open a command line terminal 3. Follow these instructions on GitHub: [https://help.github.com/articles/duplicating-a-repository/](https://help.github.com/articles/duplicating-a-repository/) ### 2. Add the result to GitBook 1. Login to [https://gitbook.com](https://gitbook.com) 2. Navigate to [https://www.gitbook.com/new](https://www.gitbook.com/new) 3. Click the down arrow below the basic templates to reveal "Import", "GitHub", and "Git" options:   4. Click **GitHub** 5. Add a title, a description, and then hit **Select Repository**. It may take a second, and you may have to click it a second time, but there will be a drop-down menu of repositories. ### 3. Connect the GitBook to updates on GitHub 1. Select the repository you just created and click **Create Book** 2. Now surf back to [https://gitbook.com](https://gitbook.com). You should see your new book. 3. Click on the book title \(_not_ **Edit**\) to reveal the dashboard for this book 4. Click **Settings**  5. Click **GitHub** on the left hand menu  6. Under WebHook, click "Add WebHook" The webhook is what tells GitBook that you have pushed updates to GitHub. When GitBook finds out about updates, it automatically generates your book. ### 4. Make sure ePub and PDF versions are generated automatically 1. On the left-hand settings menu, click **Options** 2. Scroll down to **Features** and make sure the "E-Books \(PDF, MOBI, EPUB\)" switch is on and green.  3. Click "Save" and you're done! ### 5. Delete existing pages Right clicking on a page name in the sidebar should give you the option to delete it. --- # Snippets The initial heading will be the page chapter, always. You should not add one. View the source of this page to see convenient snippets. ## This is the section heading ### Heading 3 #### Heading 4 ##### Heading ### Snippets __*(view source by clicking the aA next to the branch setting)*__ <!-- copy/paste the next line in the source to add a page-break to PDF, ePUB, MOBI --> <div class='page-break' /> <!-- copy/paste the next line in the source to add a page-break to only the student edition of the PDF, ePUB, MOBI --> {% if book.edition in ['student', 'master'] %}<div class='page-break' />{% endif %} <!-- copy/paste the next line in the source to add a page-break to only the instructor edition of the PDF, ePUB, MOBI --> {% if book.edition in ['instructor', 'master'] %}<div class='page-break' />{% endif %} <!-- wrap a block of text in a CSS class (advanced, can be used to style blocks one way or another, like coloring, font sizes, font faces, etc.) --> {% blockClass "question" %} 1. What is your favorite color? 1. blue 1. red 1. orange. 1. AAAAAAArrrrgggghhhh! {% endblockClass %} --- # Using Variables These examples are for the purpose of showing you how to do things that are a little more "advanced" than basic markdown, but needed for making beautiful docs. ## Add a variable and reference it in the book Adding a new variable to the configuration file `book.json` lets you control the content from the configuration, either by setting values (like a product name) from the configuration, or by creating a condition for conditional rendering. Variables are name-value pairs given as a quoted pair separated by a colon: ``` "name": "value" ``` Variables can be accessed in your content by referencing them using the template language: {% raw %} ``` {{ book.newVariableName }} {% if book.newVariableName == "New Value" %} Content that will only be rendered if the new variable is equal to `"New Value"` in the book.json {% endif %} ``` {% endraw %} To add a variable: 1. Make sure you are on "branch: master" according to the "version" bar  2. Edit the `"variables"` section of [book.json](book.json) ##### book.json (before) ```json { "variables": { "edition": "master", "slides": false, "outputContent": [ "content", "notes" ], "productName": "T Mobile Router" }, "plugins": ["wrapclass", "addcssjs"], "pluginsConfig": { "addcssjs": { "css": ["https://fontlibrary.org/face/hk-grotesk"] } } } ``` ##### book.json (after) ```json { "variables": { "edition": "master", "slides": false, "outputContent": [ "content", "notes" ], "productName": "T Mobile Router", "newVariableName": "New Value" }, "plugins": ["wrapclass", "addcssjs"], "pluginsConfig": { "addcssjs": { "css": ["https://fontlibrary.org/face/hk-grotesk"] } } } ``` > **Hint** Make sure that there is a comma before the variable you just added. Make sure there is *no* comma after the variable, if it is the last one. book.json **must** be valid JSON for your book to be created correctly, and Gitbook might not tell you that it isn't. > Variable *names* should **never** contain spaces. ## Using variables in content ### Using the value of a variable as text Copy the bits in the source of this page **between, but not including** the \`\`\` lines: {% raw %} ``` {{ book.variableName }} ``` {% endraw %} ### Controlling whether a block of text is rendered Copy the bits in the source of this page **between, but not including** the \`\`\` lines: {% raw %} ``` {% if book.variableName in ['value1', 'value2'] %} Insert the text you want to conditionally render here. {% endif %} ``` {% endraw %} --- # Links to Help * Markdown Syntax: https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf * Templates, variables, and conditional rendering: https://toolchain.gitbook.com/templating/ * Basic GitBook Help: https://help.gitbook.com/ * Better GitBook Help: https://toolchain.gitbook.com/pages.html --- # Links to other editions and formats * Slideshow: <a href='presentation.html' target="_blank">https://gregt-mobile.gitbooks.io/**gitbook-name**/content/presentation.html</a> * Student Edition: [https://gregt-mobile.gitbooks.io/**gitbook-name**/content/v/student-edition/](https://gregt-mobile.gitbooks.io/new-from-prototype-3/content/v/student-edition/) * Instructor Edition: [https://gregt-mobile.gitbooks.io/**gitbook-name**/content/v/instructor-edition/](https://gregt-mobile.gitbooks.io/new-from-prototype-3/content/v/instructor-edition/) * PDF: [https://www.gitbook.com/download/pdf/book/gregt-mobile/**gitbook-name**](https://www.gitbook.com/download/pdf/book/gregt-mobile/new-from-prototype-3) * EPUB: [https://www.gitbook.com/download/epub/book/gregt-mobile/**gitbook-name**](https://www.gitbook.com/download/epub/book/gregt-mobile/new-from-prototype-3) * MOBI: [https://www.gitbook.com/download/mobi/book/gregt-mobile/**gitbook-name**](https://www.gitbook.com/download/mobi/book/gregt-mobile/new-from-prototype-3) --- # Creating Slides * The link to the presentation will always be <a href="presentation.html" target="_blank">presentation.html</a> * The title of the slide will be the chapter name * To add notes, add three question marks on a blank line. * All subsequent lines will be treated as slide notes. * The end of this slide will show notes. * Each file will be a single slide. ??? These are some slide notes. They show in the presenter view and will show in the instructor edition, but not in the student edition. The slides will use the website stylesheet. We may change this in the future --- # Navigating slides * To clone the view and link it to the presenter view, hit 'C' with the slide view focused. * To go to the presenter view of the slides, hit 'P' with the slide view focused. --- # Building the book on the win10 command line 1. Open the Node.js command prompt 2. enter the following lines of code in the prompt ``` cd Desktop\Gregs Docs\gregt-mobile dir ``` Find the name of the directory containing the book you want to build. ``` cd {DIRECTORY_NAME} ``` Then enter the following **exactly** ``` copy /y book.master.json book.json gitbook build . website gitbook pdf . gitbook epub . copy /y book.student.json book.json gitbook build . website\student gitbook pdf . gitbook epub . move *.pdf website\student move *.epub website\student copy /y book.master.json book.json cd website http-server ``` Then open chrome and type `http://localhost:8080` ---