在 Cloud Shell 中編寫教學課程

Cloud Shell 支援建構及啟動教學課程,協助使用者快速有效地熟悉專案。

教學課程是一組以 Markdown 撰寫的指示。Cloud Shell 會剖析這些 Markdown 檔案中的文字,將其轉換為步驟和子步驟,然後顯示在 Google Cloud 控制台的面板中,藉此建立情境內教學課程。

在 Cloud Shell 中執行的教學課程

撰寫教學課程

教學課程以 CommonMark Markdown 編寫。系統支援其他 Markdown 擴充功能指令,包括醒目顯示功能和新增內嵌圖示等進階功能。

步驟

製作教學課程時,標題是決定結構的重要因素。 如要設定正確的標題、步驟標題和基本操作說明,請使用下列階層:

  • 教學課程標題的 H1 (#) 標記。教學課程中只能有一個 H1 標記。
  • H2 (##) 標記適用於步驟標題。
  • H3 (###) 標記適用於子步驟標題。

以下是您可以用來製作教學課程的範例 Markdown 檔案:

# First tutorial

## First step

Hello world

### Part 1

Part one instructions.

### Part 2

Part two instructions.

## Conclusion

Done!

指令

指令可啟用進階功能,例如醒目顯示功能和加入內嵌圖示。

如要新增指令,請使用下列格式:

<walkthrough-DIRECTIVE_NAME PARAMETER="PARAMETER_VALUE">
</walkthrough-DIRECTIVE_NAME>

舉例來說,如要使用 editor-open-file 指令和 filePath 參數,請依下列格式撰寫:

<walkthrough-editor-open-file filePath="test/hello.md">
</walkthrough-editor-open-file>

如需可用指令,請參閱指令參考資料

在 Cloud Shell 中啟動教學課程

在 Cloud Shell 中啟動教學課程的方法有兩種:

  1. 使用 cloudshell launch-tutorial 指令

    Cloud Shell 工作階段中執行下列 cloudshell 指令,透過現有的 Markdown 檔案「tutorial.md」啟動教學課程:

    cloudshell launch-tutorial tutorial.md
    

    或者,您可以在 Cloud Shell 工作階段中執行下列指令,透過現有的檔案「�」啟動教學課程:teachmehello.md

    teachme hello.md
    
  2. 使用「在 Cloud Shell 中開啟」

    或者,您也可以使用「Open in Cloud Shell」(在 Cloud Shell 中開啟) 功能,引導使用者從網站、網誌或開放原始碼專案前往 Git 存放區中託管的教學課程。「在 Cloud Shell 中開啟」功能支援 cloudshell_tutorial 參數,可加到網址結尾,指定存放庫中來源 Markdown 檔案的位置。這表示連結至教學課程的按鈕 Markdown 如下:

    [![Open in Cloud Shell](https://gstatic.com/cloudssh/images/open-btn.png)](https://ssh.cloud.google.com/cloudshell/open?cloudshell_git_repo=GIT_REPO_URL&cloudshell_tutorial=PATH_TO_MD_FILE)
    

後續步驟