markdown のフィールドとメソッド フィールドは、値についての単純な事実で、ドットを使い角括弧なしで読み取ります: $value.name。メソッドは引数を取るか処理を行い、-> で呼び出します: $value->name(arguments)。または、値をパイプで渡して呼び出します: $value |> name(arguments)。
フィールド フィールド 型 説明 .extensionstring 元のファイルの拡張子(ドットは含まない)です。 .textstring 囲まれた値のソーステキストです。
KScript.Document より これらには <import package="KScript.Document" />import KScript.Document が必要です。KScript.Document を参照してください。
ソースの中で最初に一致した、0から始まる位置です。見つからなければ -1 です。
例
.kscript XML コピー
<let name="notes" value="```markdown
# Notes
Some *ideas* for the launch.
```" />
<echo>{ $notes->find('ideas') }</echo>.kscript XML コピー
$notes = ```markdown
# Notes
Some *ideas* for the launch.
```
echo $notes->find('ideas')同じ形式のテキストまたはソースを、0 始まりのオフセット位置に挿入したコピーを返します。オフセットを省略すると末尾に追加します。
パラメーター 受け取るもの content 必須 任意の値 at 省略可能 int
引数には名前を付けることもできます: ->insert(…, at: …)。
例
.kscript XML コピー
<let name="notes" value="```markdown
# Notes
Some *ideas* for the launch.
```" />
<echo>{ $notes->insert(' More soon.').text }</echo>.kscript XML コピー
$notes = ```markdown
# Notes
Some *ideas* for the launch.
```
echo $notes->insert(' More soon.').textPDFのページ数です。
例
.kscript XML コピー
<let name="notes" value="```markdown
# Notes
Some *ideas* for the launch.
```" />
<echo>{ $notes->pages() } pages</echo>.kscript XML コピー
$notes = ```markdown
# Notes
Some *ideas* for the launch.
```
echo "{ $notes->pages() } pages"# markdown ->replace (search: string , replacement: string ) → markdown KScript.Document リテラル一致をすべて置き換えたコピーを返します。
引数には名前を付けることもできます: ->replace(…, replacement: …)。
例
.kscript XML コピー
<let name="notes" value="```markdown
# Notes
Some *ideas* for the launch.
```" />
<echo>{ $notes->replace('ideas', 'plans').text }</echo>.kscript XML コピー
$notes = ```markdown
# Notes
Some *ideas* for the launch.
```
echo $notes->replace('ideas', 'plans').text# markdown ->save (path: string , as?: pdf|docx|'latex'|'markdown'|html ) KScript.Document ドキュメントをファイルに書き出します。ファイル名の拡張子(または as:)で形式を選びます。.md ではソースをそのまま保存し、.pdf、.docx、.tex、.html の場合はレンダリングします。拡張子を省略すると .md になります。
パラメーター 受け取るもの path 必須 string as 省略可 次のいずれかの語: pdf|docx|'latex'|'markdown'|html
引数には名前を付けることもできます: ->save(…, as: …)。
例
.kscript XML コピー
<let name="notes" value="```markdown
# Notes
Some *ideas* for the launch.
```" />
<do>$notes->save('notes.pdf')</do>
<do>$notes->save('notes.docx')</do>.kscript XML コピー
$notes = ```markdown
# Notes
Some *ideas* for the launch.
```
$notes->save('notes.pdf')
$notes->save('notes.docx')数式とコードを除いて、テキストの単語数です。
例
.kscript XML コピー
<let name="notes" value="```markdown
# Notes
Some *ideas* for the launch.
```" />
<echo>{ $notes->words() } words</echo>.kscript XML コピー
$notes = ```markdown
# Notes
Some *ideas* for the launch.
```
echo "{ $notes->words() } words"any のメソッド