Code Monkey home page Code Monkey logo

tools's Introduction

Tools for authoring and serving codelabs

Codelabs are interactive instructional tutorials, which can be authored in Google Docs using some simple formatting conventions. You can also author codelabs using markdown syntax. This repo contains all the tools and documentation you’ll need for building and publishing your own codelabs.

If you're interested in authoring codelabs, create a doc following the Codelab Formatting Guide. and see the claat directory for a detailed description of the claat command line tool.

Also, consider joining the codelab-authors Google Group, which connects you with other authors and provides updates on new releases.

What is this?

For the past 3+ years, the CLaaT (Codelabs as a Thing) project has given developers around the world a hands-on experience with Google products and tools. We’ve accumulated over 500 high quality codelabs, served millions of web visitors, and supported over 100 events, from local meetups all the way up to Google I/O.

This project has been implemented as a volunteer project by a small group of dedicated Googlers who care deeply about this kind of “learning by doing” approach to education.

What's special about this tool?

  • Powerful and flexible authoring flow via Google Docs
  • Optional support for authoring in Markdown text
  • Ability to produce interactive web or markdown tutorials without writing any code
  • Easy interactive previewing
  • Usage monitoring via Google Analytics
  • Support for multiple target environments (kiosk, web, markdown, offline, etc.)
  • Support for anonymous use - ideal for public computers at developer events
  • Looks great, with a responsive web implementation
  • Remembers where the student left off when returning to a codelab
  • Mobile friendly user experience

Can I use this to create my own codelabs and serve my own codelabs online?

Yes, the claat tool and the serving mechanism can be used by anyone to author their own codelabs and to serve up their own codelabs on the web.

You can also use this tool to create a nice looking summary page like the one you see on the official Google Codelabs site.

If you're interested in authoring codelabs, join codelab-authors group, which connects you with other authors and provides access to the Codelab Formatting Guide.

Ok, how do I use it?

Check out this excellent tutorial.

  1. Create a doc following the syntax conventions described in the Codelab Formatting Guide. Here’s an example doc. Feel free to copy that doc as a starter template. Once you have your own source doc, note its DocId, which is the long string near the end of the URL (right after docs.google.com/document/d/).

  2. Make one or more changes and preview your codelab, using the preview app provided by Google. To preview a codelab, install the Preview Codelab Chrome extension in your browser. Now you can preview a codelab directly from the Google Doc view by clicking the Chrome extension’s button, which will open a new tab to display the preview. Alternatively, navigate manually to https://codelabs-preview.appspot.com/?file_id=

  3. Install the claat command -- see the README in the claat directory of this repo for instructions..

  4. Run the claat command to transform the doc contents into one of the supported output formats. The default supported formats are html and markdown but the claat tool supports adding additional formats by specifying a path to a Go template. For example, using the example document above:

     $ claat export 1rpHleSSeY-MJZ8JvncvYA8CFqlnlcrW8-a4uEaqizPY  
     ok      your-first-pwapp
    

    You can also specify a markdown document (.md file) as input. It has to adhere to the syntax conventions described here

     $ claat export document.md
     ok      your-md-based-codelab
    
  5. Run the claat serve command.

     $ claat serve
    

This will start a local web server and open a browser tab to the local server. Click on the hyperlink represent your codelab of interest to experience a fully rendered version.

How do I generate my own landing page?

See instructions in the site directory's readme.

How do I generate a custom view?

Copy the sample view, customize it to your liking, tag and rebuild the codelabs you want included, and then generate your view.

How do I publish my codelabs?

The output generated by claat is a purely static set of HTML or Markdown code. As such, it can be served by any web serving mechanism, including any of the following options:

Simply commit the artifacts generated by the claat command into your preferred serving vehicle and you should be ready to go.

The site directory contains tools for building your own custom landing page(s) and publishing both landing pages and codelabs to Google Cloud Storage.

Why bother with this approach when I can write tutorials directly in Markdown?

Some people like the Google Docs authoring flow, others prefer to specify their codelabs directly in Markdown. Using the Docs approach, one source format can be used to generate numerous output formats. Also, you can use a doc for the initial formulation stage, where WYSIWYG and easy collaboration are extremely useful. Once the content stabilizes, typically after the first launch, you are free to make the generated markdown your source of truth and discard the Google Doc as a controlling source. This is desirable because it gives you the ability to manage the content as code in a source control system, but it comes at the cost of having to commit to one specific output format, or having to maintain multiple sources of truth.

This tool and corresponding authoring approach are agnostic with respect to whether (and when) you choose to manage your source as a Google Doc or as Markdown text checked into a repo. The only hard and fast rule is that, at any one point in time, you should choose one or the other. Trying to simultaneously maintain a doc and a corresponding repository is a recipe for disaster.

What are the supported input formats?

  • Google Docs (following FORMAT-GUIDE.md formatting conventions)
  • Markdown

What are the supported output formats?

  • Google Codelabs - HTML and Markdown
  • Qwiklabs - Markdown
  • Cloud Shell Tutorials - Markdown with special directives
  • Jupyter, Kaggle Kernels, Colaboratory, et. al. - Markdown with format specific cells

There’s no one “best” publication format. Each format has its own advantages, disadvantages, community, and application domain. For example, Jupyter has a very strong following in the data science and Python communities.

This variety of formats is healthy because we’re seeing new innovative approaches all the time (for example, see observablehq.com, which recently launched their Beta release).

While this evolving format ecosystem is generally a good thing, having to maintain tutorials in multiple formats, or switch from one format to another can be painful. The Codelabs doc format (as specified in FORMAT-GUIDE.md) can provide a high level specification for maintaining a single source of truth, programmatically translated into one or more tutorial specific formats.

Can I contribute?

Yes, by all means. Have feature ideas? Send us a pull request or file a bug.

Where did this come from?

For several years, Googlers would rush to build new tutorials and related assets for our annual developer event, Google I/O. But every year the authoring platform and distribution mechanism changed. As a result, there was little reuse of content and serving infrastructure, And every year we essentially kept reinventing the same wheel.

For Google I/O 2014, Shawn Simister wrote a Python program which retrieved specially formatted documents from Google Drive, parsed them, and generated a nice interactive web-based user experience. This allowed authors to design their codelabs using Google Docs, with its great interactivity and collaboration features, and automatically convert those documents into beautiful web based tutorials, without needing to write a single line of code.

Later, Ewa Gasperowicz wrote a site generator, supporting the ability to publish custom landing pages, with associated branding and an inventory of codelabs specially curated for a given event.

Alex Vaghin later rewrote Shawn's Python program as a statically linked Go program (the claat command in this repo), eliminating many runtime dependencies, improving translation performance. Alex also added, among many other enhancements, a proper abstract syntax tree (to facilitate translation to different output formats), an app engine based previewer, an extensible rendering engine, support for generating markdown output. Alex also wrote the web serving infrastructure, the build tooling (based on gulp), and, with the author, the ability to self-publish codelabs directly from the preview app.

Clare Bayley has been the guru of onsite codelab experiences, running events large and small, while Sam Thorogood and Chris Broadfoot made major contributions to the onsite kiosks you may have seen at Google I/O.

Eric Bidelman redesigned the codelab user interface using Polymer components and built the g.co/codelabs landing page, to provide a beautiful user experience that looks great and works equally well on desktop and mobile devices.

Lots of other contributions have been made over the years and I’m sure that I’m neglecting some important advances but for the sake of brevity, I’ll leave it at that.

Acknowledgements

Google Codelabs exists thanks to the talents and efforts of many fine volunteers, including: Alex Vaghin, Marc Cohen, Shawn Simister, Ewa Gasperowicz, Eric Bidelman, Robert Kubis, Clare Bayley, Cassie Recher, Chris Broadfoot, Sam Thorogood, Ryan Seys, and the many codelab authors, inside and outside of Google, who have generated a veritable treasure trove of content.

Notes

This is not an official Google product.

tools's People

Contributors

akshayjpatil avatar alexismp avatar bknappgoogle avatar cassierecher avatar davidscales avatar didrocks avatar domesticmouse avatar dragonrider0o0 avatar hemchander23 avatar jasoncent avatar keyboardnerd avatar korfuri avatar kroikie avatar marcial1234 avatar mco-gh avatar mrc0113 avatar narphorium avatar nicolasgarnier avatar nlepage avatar orendain avatar rmanalan avatar rossbeale avatar samtstern avatar shawnbuso avatar skaree avatar teeler avatar wescpy avatar willlarche avatar x1ddos avatar zarinlo 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  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

tools's Issues

Markdown does not respect line returns

If you have a line return in your Markdown, claat does not respect it. An example:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce condimentum pellentesque nisl vel pellentesque. Curabitur at ligula vitae tellus laoreet vehicula. Morbi egestas tincidunt commodo. Ut convallis porta risus. Sed interdum quam rutrum, molestie neque vitae, dignissim est. Donec eget rutrum sem. Donec nec lectus sed nisl vehicula pellentesque a ut nisi. Mauris pharetra pharetra arcu eu lacinia. Maecenas quis est quis sapien convallis ornare. Nulla vel pulvinar turpis, nec finibus elit. Cras pretium maximus cursus. Morbi vitae dolor mi. Morbi vel sodales lacus.

Praesent nec dolor in quam iaculis imperdiet. Praesent venenatis at purus non dignissim. In convallis et erat a ultrices. Nam dignissim justo at diam lobortis pellentesque consequat eget augue. Aliquam pellentesque tristique nisl sit amet pellentesque. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Mauris varius auctor gravida. Donec tempor feugiat metus in suscipit.

Will render as:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce condimentum pellentesque nisl vel pellentesque. Curabitur at ligula vitae tellus laoreet vehicula. Morbi egestas tincidunt commodo. Ut convallis porta risus. Sed interdum quam rutrum, molestie neque vitae, dignissim est. Donec eget rutrum sem. Donec nec lectus sed nisl vehicula pellentesque a ut nisi. Mauris pharetra pharetra arcu eu lacinia. Maecenas quis est quis sapien convallis ornare. Nulla vel pulvinar turpis, nec finibus elit. Cras pretium maximus cursus. Morbi vitae dolor mi. Morbi vel sodales lacus. Praesent nec dolor in quam iaculis imperdiet. Praesent venenatis at purus non dignissim. In convallis et erat a ultrices. Nam dignissim justo at diam lobortis pellentesque consequat eget augue. Aliquam pellentesque tristique nisl sit amet pellentesque. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Mauris varius auctor gravida. Donec tempor feugiat metus in suscipit.

export/md: durations are turned into sentences

I exported a Google Doc codelab to markdown:

$ claat export -f md 1YZj0tKwwRz1I8uJpW2J1FApD_a02Tmw8gWZvq-thfes

The markdown is mostly well-formed, but durations become italicized sentences:

## Set up the sample project

*Duration is 5 min*

SEO friendly?

At @RestyaPlatform we're very much interested to try codelabs (thanks for open sourcing it!) for documentation section of our Restyaboard (open source Trello alternative). We understand that it is static HTML. But, as it also uses Polymer, will there be any impact on SEO? TIA

ability to show/hide solutions

When creating labs, many times I find it desirable to provide a solution to the student if they can't figure out what to do. This request to make a formatting convention that when used turns the block of text, images, etc. into a show/hide button that defaults to hiding all the content and displaying the text show solution or similar. This way it's not immediately viewable on the screen but the student can click the button to show the solution.

The content that would be hidden and then shown when clicking the button may be a combination of any of the other already defined CodeLab formatting, with the exception this show/hide feature (no nested show/hide solutions).

CC @meiheptio

Create a claat build command

Hi,

First I want to thank you for your tool. I am started using it for my own codelabs.

If I understand well, the basic workflow is :

claat export ...
claat serve 

The last command is important because all bower dependencies will be downloaded.

Do we have another command for downloading these dependencies, without launching an HTTP server. For example a claat build ?

Second question, I am looking for a docker image in order to launch claat commands without Go on my system. Do you have this image ?

Thanks again.

claat flags = options?

From trying the claat tool, it seems like flags are options. So when help defines claat <cmd> [options] src [src ...] I was not sure if the flags were the options.

Maybe update the --help
from:
claat <cmd> [options] src [src ...]
to:
claat <cmd> [flags] src [src ...]

formatting oddness with multiple bolds in one line

I have a Google Doc with a bulleted list and each bullet has bolder, then monospaced font, then plain text, then bolding and then plain text. However the formatting comes out odd in regards to the formatting on Qwiklab. The Google Doc and the Chrome Plugin appear to render properly though.

See the following screenshots to help.

Google Doc
screen shot 2017-08-07 at 2 52 39 pm

Chrome Plugin
screen shot 2017-08-07 at 2 53 15 pm

Qwiklabs
screen shot 2017-08-07 at 2 53 41 pm

Images displayed 100% full width

I am using Markdown to author the codelabs. My images are always displayed in full width. I have tried to use the html directly in Markdown but my style is tripped away on the rendered HTML.

This is how am showing the image ![App Overview](img/chuckes-app-overview.png)

I have also tried <img src="img/chuckes-app-overview.png" width="200" /> and <img src="img/chuckes-app-overview.png" style="max-width: 50%;"/> but none of this works.

image 1

No keyboard navigation?

The only way I could scroll down the page in the ES6 and First Progressive Web App labs was by dragging the scrollbar down.

What happened: Page Down and down arrow both moved me to the next screen.
What should have happened: Down arrow should move me further down the screen, not to the next screen.

Change the default colors

Am not sure if this is already supported, i would like to change the default colors used on the rendered html output. I have used Chrome developer tools to change the colors but i would prefer to pass some params and get the color changed. It would nice if i can do this when i export.

image

export: allow fetching of remote markdown

Would want this:

$ claat export https://github.com/firebase/friendlyeats-android/blob/master/docs/codelab.md

To produce this meatdata:

{
  "environment": "web",
  "source": "https://github.com/firebase/friendlyeats-android/blob/master/docs/codelab.md",
  "format": "html",
  "prefix": "../../",
  "mainga": "UA-49880327-14",
  "updated": "2018-06-20T15:15:24-07:00",
  "id": "firestore-android",
  "duration": 37,
  "title": "Cloud Firestore Android Codelab",
  "author": "[email protected]",
  "summary": "In this codelab you’ll learn how to build an Android app that uses Cloud Firestore",
  "theme": "",
  "status": [
    "published"
  ],
  "category": [
    "firebase"
  ],
  "tags": [
    "devfest-lon",
    "firebase17",
    "io2018",
    "kiosk",
    "tag-cloud",
    "tag-firebase",
    "web"
  ],
  "url": "firestore-android"
}

md: Single line breaks should be ignored

Consider the following ways to write the same text:

(1) One line:

In this codelab you will build a restaurant recommendation app on Android backed by Cloud Firestore. You will learn how to:

(2) Single line break:

In this codelab you will build a restaurant recommendation app on Android backed by Cloud Firestore. 
You will learn how to:

(3) Double line break:

In this codelab you will build a restaurant recommendation app on Android backed by Cloud Firestore. 

You will learn how to:

Right now only (1) renders as a single <p> tag, the other two insert <br> wherever a newline is found. I think that (2) should render as a single <p> tag to enable enforcing line-length limits in md source without affecting the presentation.

Convert Formatting Guide doc to a wiki page

This is in reference to the Codelab Formatting Guide.

Similar to the Examples section of the Github Markdown guide, having examples people can just copy paste and then modify with their content I feel would be much more productive than instructing them on how to do formatting.

That way folks can just scan through the document and when they see something that looks like what they want to use, they just copy the content from the formatting guide Google Doc into their Lab Doc and modify/tweak.

My apologies if this has already been discussed and I messed it when searching.

How to create a codelab?

Sorry, I don't know my question is eligible or not. But currently I want to create a codelab-style tutorial on my own. Is there a guide to do it? Thank you.

Generate FAQ in MarkDown

Accordingly to the Codelab Formatting Guide (external) in order to render FAQs we must follow this:

FAQs are easy to add. All the author needs to do is provide an unordered list of hyperlinks and preface it with a Heading 3 header with the exact text: Frequently Asked Questions. For example:

image

Output should look like this:
image

Doing so in MD we get the following
image

image

claat should store oauth tokens

Running claat requires it to auth every, single, time, it's run. It would be awesome if it could store my oauth tokens, so I don't need to auth every time I run it.

We use it to deploy code labs to d.g.c/web, which means it's usually run 4 or 5 times a week by the same person.

Adding more styled buttons

Hi all,

I would love to add more styled buttons to accompany our current green download button.

Also, is it more constructive for me to introduce feature request and gauge community interest here or in this Google Group?

Best,
Henry

md: Images stretched to 100% width

When I make a codelab from a Google doc it appears that images are given a max width attribute. With markdown they are not, which means that the width: 100% style from step-style.html takes over.

I get this:
image

But I want this:
image

md: Support includecode tags

I'd love to see an ability to include code snippets in markdown codelabs like we already do in our "core" documentation.

This could be done in a few ways:

  • If devsite becomes the serving platform for codelabs then it might "just work" if the directive is left in the final HTML.
  • claat export could resolve these imports into static <pre> tags. Re-implementing the includecode feature is not hard (I've done it a few times).

For some reference, the syntax used on devsite is:

{% includecode github_path="user-repo/path/to/File.ext" region_tag="my_region" %}

claat tool should auto-generate author tag for web fundamentals

Consider supporting an optional metadata field for including authorship attribution in the generated codelab.

@petele - Did you want this to generate a WF specific tag in the generated markdown? Or include an author field in the codelab.json file, which could be parsed by the web fundamentals build tooling?

claat drops text from hyperlink when exporting to markdown

When exporting to markdown, claat seems to drop the link text for some types of links. It appears to work fine when exporting as HTML.

From what I can tell, it happens when the hyperlink in the doc is meant to be a button (has a green background in docs).

Repro Steps:

  1. Export Your First PWA Code Lab (1rpHleSSeY-MJZ8JvncvYA8CFqlnlcrW8-a4uEaqizPY) as markdown.

Expected result:
No links in the form of [](https://github.com/googlecodelabs/your-first-pwapp/archive/master.zip)

claat: cmd line argument for access token

In addition to storing credentials in $HOME/.config/claat, the program should also accept alternative credentials provided from the command line arguments.

For instance:

claat export -auth <access_token> ...other args...

This will allow to use claat binary in CI and other such systems where robots rule the world.

The -auth argument must take precedence over other credentials (if any).

export/md: missing metadata

If you do the following:

$ claat export -f md $GDOC_ID

You get an MD file with no metadata section, the first line is a # tag. So when you go to export the md file to get servable HTML you get:

$ claat export index.md 
err	index.md invalid metadata format, missing at least id: map[]

Markdown formatting not working

Apologies if this is documented somewhere already. Am using the standard markdown, but when i export and the serve the file, the markdown for bold or code doesnt show up.

Which markdown tags are supported? Is bold not supported? Or italics. Part of my code does get formatted but not all of it.

I also can not get a new line. How do i add a new line?

Here is the contents of my test file below :

author: Mariusz Saramak
summary: TomTom Creating a custom Gangnam vector map style
categories: sdk
environments: sql
status: draft
feedback link: github.com/tomtom-gangdam-style-for-map
analytics account: 0

# Demo Codelab

## Introduction

* Modify a default TomTom style for vector maps with use of the Maputnik editor `code`
* Apply the newly created style
Prerequesites
* API key
* Npm and Node.js

Negative
: To get an API key you need register or sign in to TomTom Developer Portal. Request an evaluation API key to access the service you want to use the SDK with.


Positive
: It is possible to have a single key(app) for all TomTom services, but you can also choose : to have individual keys for the different services.

## Set STATISTICS IO 
Duration 00:05

`SET STATISTICS IO` displays the amount of disk activity generated by a query. To enable it, run the following statement:

```sql
SET STATISTICS TIME ON
```

and now can run a query and check the message tab :

```sql
SELECT DISTINCT(CustomerID)
FROM Sales.
```

## Clean the Buffer Cache
Duration 00:05

We can remove all the cached pages from the buffer by running :

```sql
DBCC DROPCLEANBUFFERS
```

When testing, its recommended to clean the buffer and run the query. This will give you a true picture of the performance of the query.

Then run the following query:

```sql
SELECT * FROM Sales.SalesOrderDetail WHERE ProductID = 870
```
It will show an output similar to the following:

Here are the definitions of these items, which all use 8K pages:

1. Logical reads Number of pages read from the buffer pool.

2. **Physical reads** Number of pages read from disk.

3. **Read-ahead reads** Read-ahead is a performance optimization mechanism that anticipates the needed data pages and reads them from disk. It can read up to 64 contiguous pages from one data file.

- **Lob logical** reads Number of large object (LOB) pages read from the buffer pool.

- **Lob physical** reads Number of large object (LOB) pages read from disk.

- **Lob read-ahead** reads Number of large object (LOB) pages read from disk using the read-ahead mechanism, as explained earlier.

Now, if you run the same query again, you will no longer get physical and read-ahead reads. 


**Scan count**is defined as the number of seeks or scans started after reaching the leaf level (that is, the bottom level of an index). The only case when scan count will return 0 is when you’re seeking for only one value on a unique index, like in the following example:

```sql
SELECT * FROM Sales.SalesOrderHeader WHERE SalesOrderID = 51119
```

If you try the following query, in which SalesOrderID is defined in a nonunique index and can return more than one record, you can see that scan count now returns 1:

```sql
SELECT * FROM Sales.SalesOrderDetail WHERE SalesOrderID = 51119
```

Finally, in the following example, scan count is 4 because SQL Server has to perform four seeks:

```sql
SELECT * FROM Sales.SalesOrderHeader WHERE SalesOrderID IN (51119, 43664, 63371, 75119)
```

## Removing Plans from the Plan Cache
Duration 00:05

![Image](images/lob.jpg)

You can use a few different commands to remove plans from the plan cache :


`DBCC FREEPROCCACHE` statement can be used to remove all the entries from the plan cache. It can also accept a plan handle or a SQL handle to remove only specific plans.

* _DBCC FREEPROCCACHE_ statement can be used to remove all the entries from the plan cache. It can also accept a plan handle or a SQL handle to remove only specific plans.
* __DBCC FREESYSTEMCACHE__ statement can be used to remove all the elements from the plan cache or only the elements associated with a Resource Governor pool name.
* **DBCC FLUSHPROCINDB** can be used to remove all the cached plans for a particular database
* `DBCC DROPCLEANBUFFERS` statement can be used to remove all the buffers from the buffer pool. You can use this statement in cases where you want to simulate a query starting with a cold cache

```java
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.example.android.codelabs.paging.db

import android.arch.lifecycle.LiveData
import android.arch.persistence.room.Dao
import android.arch.persistence.room.Insert
import android.arch.persistence.room.OnConflictStrategy
import android.arch.persistence.room.Query
import com.example.android.codelabs.paging.model.Repo
import javax.sql.DataSource

/**
 * Room data access object for accessing the [Repo] table.
 */
@Dao
interface RepoDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(posts: List)

    // Do a similar query as the search API:
    // Look for repos that contain the query string in the name or in the description
    // and order those results descending, by the number of stars and then by name
    @Query("SELECT * FROM repos WHERE (name LIKE :queryString) OR (description LIKE " +
            ":queryString) ORDER BY stars DESC, name ASC")
    fun reposByName(queryString: String): LiveData>

//    @Query("SELECT * FROM repos WHERE (name LIKE :queryString) OR (description LIKE " +
//            ":queryString) ORDER BY stars DESC, name ASC")
//    fun  reposByTA(queryString: String) : DataSource.Factory

}
```

demo_codelab

Sanitize/clean metadata

Mostly for me so that I won't forget:

Sometimes metadata like URL may take a non-clean value such as code-\n\n\n-lab. Needs a clean up function.

md: Make exported markdown (from GDoc) match what you would hand-write

I want claat export -f md $GDOC_ID to match the style of a markdown file written manually by an author.

Here are some discrepancies I found in a codelab I happen to have hand-written as both a md file and a GDoc

Metadata

The exported metadata has some spurious line breaks and possibly uses some incorrect attribute IDs (or maybe my handwritten one had the wrong IDs).

Handwritten

---
id: firestore-android
summary: In this codelab you'll learn how to build an Android app that uses Cloud Firestore
author: [email protected]
categories: Firebase
tags: web, kiosk, firebase17, devfest-lon, io2018, tag-firebase, tag-cloud
status: Published
feedback_url: https://github.com/firebase/friendlyeats-android/issues

---

Exported

---
id: firestore-android
status: [published]
summary: In this codelab you'll learn how to build an Android app that uses Cloud Firestore.

categories: Firebase
tags: devfest-lon,firebase17,io2018,kiosk,tag-cloud,tag-firebase,web
feedback link: https://github.com/firebase/friendlyeats-android/issues


---

Durations

The exported codelab does not add the optional :ss to minute-durations, which makes reading less clear.

Handwritten

Duration: 1:00

Exported

Duration: 1

Code Blocks

The exported codelab uses the four-spaces-indent method for fenced code blocks. Using "```" makes the formatting more explicit. It also opens up future use of the Github-style "```language" format for specifying the language for pretty-printing.

Handwritten

\```
$ git clone https://github.com/firebase/friendlyeats-android
\```

Exported

    $ git clone https://github.com/firebase/friendlyeats-android

Bolding

This one is highly subjective but I find ** to be the more common way to add emphasis than __

Handwritten

click **Publish**

Exported

click __Publish__

Callouts

Callouts are broken when exporting from md to html. The new parser uses the special markdown infoboxes spec addition rather than the <aside> tag.

Exported

<aside class="special">

__Note__: this codelab demonstrates the real-time capabilities of Firestore, but it's also simple to fetch data without a listener.  You can call `get()` on any query or reference to fetch a data snapshot.
</aside>

Handwritten

positive
: **Note**: this codelab demonstrates the real-time capabilities of Firestore, but it's also simple to fetch data without a listener. You can call get() on any query or reference to fetch a data snapshot.

claat: support user-input in command-line snippets

The command-line snippet can be enhanced in order to show which is the user-input text among the text output of the commands.

Existing codelabs are using different conventions in showing command-line commands. Some are omitting the shell prompt altogether, others do not show any output from the commands which can be confusing to the users.

For a codelabs author, they should just make bold the parts of the command-line input that is actual user-input. Then claat should show this text in a distinctive way to denote user-input.

See screenshot of commands with user-input in bold

Source format instructions not found

The help says that the source formats currently supported are:

  • Google Doc (Codelab Format, go/codelab-guide)
  • Markdown

However, i was unable to find any instructions on how to format the input document.

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.