diff --git a/Cargo.lock b/Cargo.lock index ec5fdb3..d4ec44b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -887,7 +887,7 @@ dependencies = [ [[package]] name = "mdbook-embedify" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap", "mdbook", diff --git a/Cargo.toml b/Cargo.toml index f5e3bfd..65f78b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mdbook-embedify" -version = "0.0.1" +version = "0.0.2" edition = "2021" license = "MIT" readme = "README.md" diff --git a/README.md b/README.md index 162bf0c..82ed0d1 100644 --- a/README.md +++ b/README.md @@ -26,10 +26,10 @@ Then you can use `embed` macro to embed an app. The syntax is like this: {% embed app options[] %} ``` -**options** are key-value based array seperated by space and its value must be wrapped by quotes. For example: +**options** are key-value based array seperated by space and its value must be wrapped by **quotes**. For example: ```text -{% embed codepen username="MR-Addict" slug="NWBOqKw" height="600" theme="dark" %} +{% embed codepen user="MR-Addict" slug="NWBOqKw" height="600" theme="dark" %} ``` ## 3. Examples diff --git a/docs/index.css b/docs/index.css index 6f52a70..9e5ea75 100644 --- a/docs/index.css +++ b/docs/index.css @@ -105,6 +105,10 @@ pre { color: red; } +iframe:not(:last-of-type) { + margin-bottom: 2rem; +} + @media (max-width: 600px) { body { padding: 0.5rem; diff --git a/docs/index.html b/docs/index.html index d04204c..9df582e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -45,7 +45,7 @@

2. Usage

For example:

-
{% embed codepen username="MR-Addict" slug="NWBOqKw" height="600" theme="dark" %}
+
{% embed codepen user="MR-Addict" slug="NWBOqKw" height="600" theme="dark" %}

Below is the list of supported apps and their options(* means required):

@@ -57,17 +57,29 @@

2. Usage

+ + gist + id* + youtube id* - gist + bilibili id* + + codesandbox + id*, theme(dark) + + + stackblitz + id*, theme(dark) + codepen - username*, slug*, height, theme + user*, slug*, theme(dark), height(600) @@ -76,13 +88,13 @@

2. Usage

3. Examples

-

3.1 Gist

+

Gist

{% embed gist id="76cf171d1bdd7da41d4ca96b908eb57a" %}
-

3.2 Youtube

+

Youtube

{% embed youtube id="EngW7tLk6R8" %}
@@ -93,9 +105,44 @@

3.2 Youtube

allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" > -

3.3 Codepen

+

Bilibili

+ +
{% embed bilibili id="BV1uT4y1P7CX" danmaku="0" %}
+ + + +

Codesandbox

+ +
{% embed codesandbox id="ke8wx" theme="dark" %}
+ + + +

Stackblitz

+ +
{% embed stackblitz id="vitejs-vite-y8mdxg" theme="light" %}
+ + +
+ +
+

Codepen

-
{% embed codepen username="MR-Addict" slug="NWBOqKw" height="600" theme="dark" %}
+
{% embed codepen user="MR-Addict" slug="NWBOqKw" height="600" theme="dark" %}
diff --git a/templates/codepen.html b/templates/codepen.html index ef3e2fa..a86a591 100644 --- a/templates/codepen.html +++ b/templates/codepen.html @@ -1,8 +1,8 @@ diff --git a/templates/codesandbox.html b/templates/codesandbox.html new file mode 100644 index 0000000..b97c791 --- /dev/null +++ b/templates/codesandbox.html @@ -0,0 +1,6 @@ + diff --git a/templates/stackblitz.html b/templates/stackblitz.html new file mode 100644 index 0000000..8393226 --- /dev/null +++ b/templates/stackblitz.html @@ -0,0 +1,6 @@ + diff --git a/templates/youtube.html b/templates/youtube.html index 8503a8b..397f316 100644 --- a/templates/youtube.html +++ b/templates/youtube.html @@ -1,5 +1,7 @@