內容簡介
Blog Terminal 創建了一個終端風格的框,您可以使用它來演示終端輸出或展示輸入終端/控制台命令的過程,以更形象地展示實際使用 Linux/Unix 終端或 Windows cmd shell 的方式。
這個插件的程式碼是 Post Terminal 的分支,而 Post Terminal 則是 WP-Terminal 的分支,而 WP-Terminal 則是 WP-Syntax 的修改版,這是 WordPress 的一個原始碼突顯插件。
與 Post Terminal 不同的是,它使用 [terminal] 簡寫來表示終端框,它只在顯示顯式设置要顯示提示的行時顯示提示。
基本用法
最基本的用法是將您的終端區塊包裹在 [terminal] 和 [/terminal] 標籤中。如果標籤中沒有進一步定義選項,將生成一個通用提示符,使用'user@computer',不顯示工作目錄。這與在sh(1)中導出PS1="(\u)@\h: ",在csh(1)中設置prompt="%n@%m: "等是類似的。
標籤中的其他選項包括 user="user",computer="computer" 和 cwd="/path/to/directory"。這些選項允許您覆蓋通用的 user@computer 設置,以及提供“當前工作目錄”。
提示僅顯示以'$ '開頭的行。因此,您可以將命令和模擬的終端輸出混合使用。
用法
用 [terminal user="username" computer="computername" cwd="/path/to/directory"] 和 [terminal] 包裹終端塊。它們都是可選的。如果您沒有提供其值,將顯示“user”和“computer”,而 cwd 則純粹是選擇性的。
範例 1:未定制的命令
[terminal]
$ ls -a
[/terminal]
範例 2:使用者和電腦的自定義設置
[terminal user="tux" computer="linux"]
$ ls -a
[/terminal]
範例 3:僅定制使用者
[terminal user="dak"]
$ ls -a
[/terminal]
範例 4:定制使用者、電腦並顯示工作目錄
[terminal user="root" computer="linuxserver" cwd="/usr/src/linux"]
$ make mrproper
...
...
[/terminal]
外掛標籤
開發者團隊
原文外掛簡介
Blog Terminal generates a terminal-like box that you can use to demonstrate terminal output or show the entry of terminal/console commands in a manner that is more demonstrative of actually using a Linux/Unix terminal or Windows cmd shell.
The code is a fork of Post Terminal, which is a fork of WP-Terminal which in turn is a modification of WP-Syntax, a source code highlighter plugin for WordPress.
Unlike Post terminal, it uses [terminal] shorthand for the terminal box. It also shows prompt only on lines explitly set to do that.
Basic Usage
The most basic usage is to wrap your terminal blocks with [terminal][/terminal] tags. If no further options are defined within the tag a generic prompt is generated using ‘user@computer’ with no working directory shown. This is similar to exporting PS1=”\u@\h:$ ” in sh(1), setting prompt=”%n@%m:$ ” in csh(1), etc.
Other options available within the tag are user=”user”, computer=”computer”, and cwd=”/path/to/directory”. These allow you to override the generic user@computer settings as well as provide a ‘current working directory’.
The prompt is only shown on the lines starting with ‘$ ‘. So you can mix commands with simulated terminal output.
Usage
Wrap terminal blocks with [terminal user="username" computer="computername" cwd="/path/to/directory"] and [\terminal]. They are all optional. “user” and “computer” will be shown if you don’t provide them, cwd is purely optional.
Example 1: No customized command
[terminal]
$ ls -a
[/terminal]
Example 2: User and computer customizations
[terminal user="tux" computer="linux"]
$ ls -a
[/terminal]
Example 3: Customizing just the user
[terminal user="dak"]
$ ls -a
[/terminal]
Example 4: Customizing user, computer and displaying a working directory
[terminal user="root" computer="linuxserver" cwd="/usr/src/linux"]
$ make mrproper
...
...
[/terminal]
