R 関数によって生成された HTML の埋め込み
P粉513316221
P粉513316221 2024-04-01 20:51:51
0
1
376

HTMLを動的に構築してそのHTMLをレンダリングしたい クォートで。 実際のアプリケーションには iFrame の挿入が含まれます。 ただし、簡単にするために、<img> タグを作成するだけにしておきます。

これは私の .qmd コードです:

リーリー

レンダリングされ、関数が呼び出されるのは明らかです。 ただし、画像の代わりに HTML コードが表示されます:

これは簡単なことだとはわかっていますが、見つかりません。どうもありがとうございます!

P粉513316221
P粉513316221

全員に返信(1)
P粉883973481

注意すべき点が 2 つあります:

  • まず、Quarto はデフォルトでコード ブロック出力を

     tag. To get the output asis you need to use the chunk option results: asis.

  • Secondly, sprintf (or even print) returns output enclosed within quotes. So after using results: asis, you would get the html tags but would also get the quotes. So you need to wrap the sprintf with cat to get intended results.

---
format: html
---

```{r}
#| echo: false
imageLink  %s", iUrl, iText))
}
```

```{r}
#| echo: false
#| results: asis
imageLink("https://www.united.com/8cd8323f017505df6908afc0b72b4925.svg", "united logo")
```

and now, here's what it's supposed to look like:

 united logo
でラップします。
いいねを押す +0
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!