diff --git a/sample/codelab.md b/sample/codelab.md index d980a115b..bd52aebf3 100644 --- a/sample/codelab.md +++ b/sample/codelab.md @@ -9,20 +9,22 @@ feedback link: https://github.com/Mrc0113/codelab-4-codelab # CodeLab to Create a CodeLab ## CodeLab Overview + Duration: 0:02:00 -Are you trying to create easy to use, visually appealing content for the tech community? This CodeLab will show you how to quickly create your own Google CodeLab just like the one you're using right now. -When creating a Codelab you have two authoring options: +Are you trying to create easy to use, visually appealing content for the tech community? This CodeLab will show you how to quickly create your own Google CodeLab just like the one you're using right now. +When creating a Codelab you have two authoring options: + 1. Using a Google Doc 1. Using a markdown file -In this codelab we are going to use the second option and author our codelab using a markdown file. This gives us the flexibility of using our markdown file for other things and also storing it in our github repo with any code that might be used for a tutorial. +In this codelab we are going to use the second option and author our codelab using a markdown file. This gives us the flexibility of using our markdown file for other things and also storing it in our github repo with any code that might be used for a tutorial. Here is an example image of another CodeLab that I created: ![image_caption](img/codelabexample.png) +**Resources:** -**Resources:** * This codelab's original home is located here: [Link to Codelab](https://www.marcd.dev/codelab-4-codelab) * The markdown for the original codelab is located here: [codelab.md](https://github.com/Mrc0113/codelab-4-codelab/blob/master/codelab.md) * [Google CodeLabs Tools Github](https://github.com/googlecodelabs/tools) - The repo that contains the claat tool we'll be using today @@ -30,57 +32,66 @@ Here is an example image of another CodeLab that I created: * [A blog that I used when getting started with Google Codelabs](https://medium.com/@mariopce/tutorial-how-to-make-tutorials-using-google-code-labs-gangdam-style-d62b35476816) ## Environment Setup + Duration: 0:04:00 In order to create a CodeLab you need *Go* and *claat* (the codelabs command line tool) installed. -The instructions below are what worked for me on Mac, but you can also find instructions [here](https://github.com/googlecodelabs/tools/tree/master/claat) +The instructions below are what worked for me on Mac, but you can also find instructions [here](https://github.com/googlecodelabs/tools/tree/master/claat) -#### Install Go +#### Install Go Install [Go](https://golang.org/dl/) if you don't have it. -You can use Homebrew if you have it on mac +You can use Homebrew if you have it on mac + ``` bash -$ brew install go +brew install go ``` #### Setup Go Environment Variables + Below is what I set on mac, but instructions are [here](https://golang.org/doc/install) for other OS options ``` bash -$ export GOPATH=$HOME/Go -$ export GOROOT=/usr/local/opt/go/libexec -$ export PATH=$PATH:$GOPATH/bin -$ export PATH=$PATH:$GOROOT/bin +export GOPATH=$HOME/Go +export GOROOT=/usr/local/opt/go/libexec +export PATH=$PATH:$GOPATH/bin +export PATH=$PATH:$GOROOT/bin ``` #### Install claat + Install claat + ``` bash -$ go get -u -v -x github.com/googlecodelabs/tools/claat +go get -u -v -x github.com/googlecodelabs/tools/claat ``` -You should now have the *claat* command available to you. +You should now have the *claat* command available to you. + ``` bash -$ claat +claat ``` ## Create your initial CodeLab + Duration: 0:05:00 -Now that we have the environment setup let's go ahead and create a markdown file where we'll create the actual codelab. +Now that we have the environment setup let's go ahead and create a markdown file where we'll create the actual codelab. Negative -: If you're using Windows make sure to set your text editor to use UNIX line endings! +: If you're using Windows make sure to set your text editor to use UNIX line endings! #### + ``` bash -$ vim codelab.md +vim codelab.md ``` #### Fill-in the header metadata -Copy and paste the headers below into your markdown file and change the values appropriately. -Guidelines are available below the sample headers. + +Copy and paste the headers below into your markdown file and change the values appropriately. +Guidelines are available below the sample headers. ``` bash author: Author Name @@ -109,26 +120,30 @@ will be understood by the renderer: "Kiosk" will only be available at codelabs kiosks, which have special equipment attached. * Status: The publication status of the codelab. Valid values are: - - Draft: Codelab is not finished. - - Published: Codelab is finished and visible. - - Deprecated: Codelab is considered stale and should not be widely advertised. - - Hidden: Codelab is not shown in index. + * Draft: Codelab is not finished. + * Published: Codelab is finished and visible. + * Deprecated: Codelab is considered stale and should not be widely advertised. + * Hidden: Codelab is not shown in index. * Feedback Link: A link to send users to if they wish to leave feedback on the codelab. * Analytics Account: A Google Analytics ID to include with all codelab pages. #### Add the Title + Next add your title using a single '#' character + ``` # Title of codelab ``` #### Add Sections and Durations + Then for each section use Header 2 or '##' and specify an optional duration beneath for time remaining calculations Optional section times will be used to automatically total and remaining tutorial times In markdown I've found that the time is formatted hh:mm:ss Example + ``` bash ## Section 1 Duration: 0:10:00 @@ -138,13 +153,15 @@ Duration: 0:05:00 ``` #### Add Section Content -Now that we have 2 sections to our titled codelab let's go ahead and add some content to each section. -Make up your own or copy and paste the example below: + +Now that we have 2 sections to our titled codelab let's go ahead and add some content to each section. +Make up your own or copy and paste the example below: Copy into section 1 (Below Duration and above Section 2): + ``` ### Info Boxes -Plain Text followed by green and yellow info boxes +Plain Text followed by green and yellow info boxes Negative : This will appear in a yellow info box. @@ -171,7 +188,8 @@ You created a numbered list! ``` -Copy into section 2 (Below Duration): +Copy into section 2 (Below Duration): + ``` ### Add a Link Adding a link! @@ -188,32 +206,33 @@ Adding an image! More Markdown Parser examples can be found [here](https://github.com/googlecodelabs/tools/tree/master/claat/parser/md). ## Export and Serve + Duration: 0:02:00 -Now that you have an initial codelab defined in your markdown file let's go ahead and generate the static site content. -We can export and serve the content locally using the `claat` command that we installed earlier. +Now that you have an initial codelab defined in your markdown file let's go ahead and generate the static site content. +We can export and serve the content locally using the `claat` command that we installed earlier. ``` bash -$ claat export codelab.md -$ claat serve +claat export codelab.md +claat serve ``` -* Your browser should have opened (if it doesn't then try going to localhost:9090 in your browser). -* Choose the directory that matches your "id" that you put in the headers. +* Your browser should have opened (if it doesn't then try going to localhost:9090 in your browser). +* Choose the directory that matches your "id" that you put in the headers. * Viola! You should have your first codelab! ## Host Your CodeLab + Duration: 0:01:00 -When you ran the `claat export` command you created the static web content needed to host your codelab. -It placed static web content in a directory specified by your unique "id" and you can view it locally by opening the index.html page. +When you ran the `claat export` command you created the static web content needed to host your codelab. +It placed static web content in a directory specified by your unique "id" and you can view it locally by opening the index.html page. Negative -: Note that when you view it locally by opening index.html some of the graphics may not show up (such as access_time, Next, Back), but they work once online. - +: Note that when you view it locally by opening index.html some of the graphics may not show up (such as access_time, Next, Back), but they work once online. Now that you have the static content you can host it however you want. -One option is pushing it to github and serving it up from Netlify. +One option is pushing it to github and serving it up from Netlify. -If you'd like to create your own landing page for codelabs, [like this one](https://codelabs.developers.google.com), there is a tool to do that as well! +If you'd like to create your own landing page for codelabs, [like this one](https://codelabs.developers.google.com), there is a tool to do that as well! Check it out here: [CodeLabs Site](https://github.com/googlecodelabs/tools/blob/master/site/README.md)