| 
1 | 1 | <div class="info-box">  | 
2 | 2 | 
 
  | 
3 |  | -Typst's HTML export is currently under active development. The feature is still  | 
4 |  | -very incomplete and only available for experimentation behind a feature flag. Do  | 
5 |  | -not use this feature for production use cases. In the CLI, you can experiment  | 
6 |  | -with HTML export by passing `--features html` or setting the `TYPST_FEATURES`  | 
7 |  | -environment variables to `html`. In the web app, HTML export is not available at  | 
8 |  | -this time. Visit the [tracking issue](https://github.com/typst/typst/issues/5512)  | 
9 |  | -to follow progress on HTML export and learn more about planned features.  | 
 | 3 | +TypstのHTMLエクスポートは現在積極的に開発が行われています。  | 
 | 4 | +この機能はまだ非常に不完全であり、機能フラグを有効にした場合に、実験目的でのみ利用可能です。  | 
 | 5 | +本番環境における利用ではこの機能を使用しないでください。  | 
 | 6 | +CLIでは`--features html`オプションを指定するか環境変数`TYPST_FEATURES`に`html`を設定することでHTMLエクスポートを試すことができます。  | 
 | 7 | +Webアプリでは、現時点でHTMLエクスポートは利用できません。  | 
 | 8 | +HTMLエクスポートに関する進捗を追跡し、計画されている機能について詳しく知るには、  | 
 | 9 | +[tracking issue](https://github.com/typst/typst/issues/5512)を参照してください。  | 
10 | 10 | </div>  | 
11 | 11 | 
 
  | 
12 |  | -HTML files describe a document structurally. The aim of Typst's HTML export is  | 
13 |  | -to capture the structure of an input document and produce semantically rich HTML  | 
14 |  | -that retains this structure. The resulting HTML should be accessible,  | 
15 |  | -human-readable, and editable by hand and downstream tools.  | 
16 |  | - | 
17 |  | -PDF, PNG, and SVG export, in contrast, all produce _visual_ representations of a  | 
18 |  | -fully-laid out document. This divergence in the formats' intents means that  | 
19 |  | -Typst cannot simply produce perfect HTML for your existing Typst documents. It  | 
20 |  | -cannot always know what the best semantic HTML representation of your content  | 
21 |  | -is.  | 
22 |  | - | 
23 |  | -Instead, it gives _you_ full control: You can check the current export format  | 
24 |  | -through the [`target`]($target) function and when it is set to HTML, generate [raw HTML  | 
25 |  | -elements]($html.elem). The primary intended use of these elements is in  | 
26 |  | -templates and show rules. This way, the document's contents can be fully  | 
27 |  | -agnostic to the export target and content can be shared between PDF and HTML  | 
28 |  | -export.  | 
29 |  | - | 
30 |  | -Currently, Typst will always output a single HTML file. Support for outputting  | 
31 |  | -directories with multiple HTML documents and assets, as well as support for  | 
32 |  | -outputting fragments that can be integrated into other HTML documents is  | 
33 |  | -planned.  | 
34 |  | - | 
35 |  | -Typst currently does not output CSS style sheets, instead focussing on emitting  | 
36 |  | -semantic markup. You can of course write your own CSS styles and still benefit  | 
37 |  | -from sharing your _content_ between PDF and HTML. For the future, we plan to  | 
38 |  | -give you the option of automatically emitting CSS, taking more of your existing  | 
39 |  | -set rules into account.  | 
40 |  | - | 
41 |  | -# Exporting as HTML  | 
42 |  | -## Command Line  | 
43 |  | -Pass `--format html` to the `compile` or `watch` subcommand or provide an output  | 
44 |  | -file name that ends with `.html`. Note that you must also pass `--features html`  | 
45 |  | -or set `TYPST_FEATURES=html` to enable this experimental export target.  | 
46 |  | - | 
47 |  | -When using `typst watch`, Typst will spin up a live-reloading HTTP server. You  | 
48 |  | -can configure it as follows:  | 
49 |  | - | 
50 |  | -- Pass `--port` to change the port. (Defaults to the first free port in the  | 
51 |  | -  range 3000-3005.)  | 
52 |  | -- Pass `--no-reload` to disable injection of a live reload script. (The HTML  | 
53 |  | -  that is written to disk isn't affected either way.)  | 
54 |  | -- Pass `--no-serve` to disable the server altogether.  | 
55 |  | - | 
56 |  | -## Web App  | 
57 |  | -Not currently available.  | 
58 |  | - | 
59 |  | -# HTML-specific functionality  | 
60 |  | -Typst exposes HTML-specific functionality in the global `html` module. See below  | 
61 |  | -for the definitions it contains.  | 
 | 12 | +HTMLファイルでは文書を構造的に記述します。  | 
 | 13 | +TypstのHTMLエクスポートの目的は、入力文書の構造を捉え、  | 
 | 14 | +この構造を保持する、意味付けが豊かなHTMLを生成することです。  | 
 | 15 | +生成されるHTMLは、アクセシビリティに優れ、人間が読みやすく、手作業での編集や下流のツールによる処理が可能であるべきです。  | 
 | 16 | + | 
 | 17 | +対照的に、PDF、PNG、SVGエクスポートはすべて、  | 
 | 18 | +完全にレイアウト済みの文書の _視覚的_ 表現を生成します。  | 
 | 19 | +このようなフォーマットの意図の違いにより、  | 
 | 20 | +Typstは既存のTypst文書に対して完璧なHTMLを単純に生成することはできません。  | 
 | 21 | +Typstがあなたのコンテンツにとって最適に意味付けされたHTML表現が何であるかを常に知ることはできないためです。  | 
 | 22 | + | 
 | 23 | +代わりに、Typstは _あなた_ に完全な制御を委ねます。  | 
 | 24 | +[`target`]($target)関数で現在のエクスポート形式を確認でき、これがHTMLに設定されている場合、  | 
 | 25 | +[生のHTML要素]($html.elem)を生成できます。  | 
 | 26 | +これらの要素は主にテンプレートやshowルールでの使用を想定しています。  | 
 | 27 | +このようにすることで、  | 
 | 28 | +文書の内容はエクスポート先に依存せず、PDFとHTMLの両方で共有できます。  | 
 | 29 | + | 
 | 30 | +現時点では、  | 
 | 31 | +Typstは常に単一のHTMLファイルを出力します。  | 
 | 32 | +複数のHTML文書やアセットを含むディレクトリの出力、  | 
 | 33 | +他のHTML文書に統合できるフラグメント出力は今後の実装が予定されています。  | 
 | 34 | + | 
 | 35 | +Typstは現状ではCSSスタイルシートを出力せず、意味付けされたマークアップの生成に重点を置いています。  | 
 | 36 | +もちろん、独自にCSSスタイルを書くこともでき、  | 
 | 37 | +そうすればPDFとHTMLの間で _コンテンツ_ を共有する利点をそのまま享受できます。  | 
 | 38 | +将来的には、既存のsetルールをより多く考慮に入れた上で、  | 
 | 39 | +CSSを自動的に出力するオプションを提供する予定です。  | 
 | 40 | + | 
 | 41 | +# HTML形式でのエクスポート  | 
 | 42 | +## コマンドライン  | 
 | 43 | +`compile`または`watch`サブコマンドに`--format html`オプションを指定するか、`.html`で終わる出力ファイル名を指定します。  | 
 | 44 | +この実験的なエクスポートターゲットを有効にするには、`--features html`オプションを指定するか、  | 
 | 45 | +環境変数`TYPST_FEATURES=html`を設定する必要があることに注意してください。  | 
 | 46 | + | 
 | 47 | +`typst watch`を使用すると、Typstはライブリロード対応のHTTPサーバーを起動します。  | 
 | 48 | +設定は以下の方法で可能です。  | 
 | 49 | + | 
 | 50 | +- `--port`オプションでポート番号を変更します。  | 
 | 51 | +(デフォルトでは3000-3005の範囲で最初に利用可能なポートが使用されます)。  | 
 | 52 | +- `--no-reload`オプションでライブリロードスクリプトの注入を無効にします。  | 
 | 53 | +(いずれにせよディスクに書き込まれるHTMLには影響しません)。  | 
 | 54 | +- `--no-serve`オプションでサーバー機能が完全に無効になります。  | 
 | 55 | + | 
 | 56 | +## Webアプリ  | 
 | 57 | +現在利用できません。  | 
 | 58 | + | 
 | 59 | +# HTML固有の機能  | 
 | 60 | +Typstでは、グローバルな`html`モジュールを通じてHTMLに固有の機能を提供しています。  | 
 | 61 | +そのモジュールに含まれる定義については、以下を参照してください。  | 
0 commit comments