Compare commits

...

8 Commits
1.0.1 ... main

Author SHA1 Message Date
9dd05e2c2d
Update README.md 2024-04-10 21:06:14 +05:30
f00a020e4a
Update README 2024-04-10 21:03:59 +05:30
b817ad02d9
Update README 2024-04-10 20:57:24 +05:30
1c08b27e2e
Update minAppVersion 2024-04-10 20:34:22 +05:30
e22d203f7f
Updating funding url 2024-04-10 20:30:24 +05:30
98d096535c
Remove console.log 2024-04-10 20:29:33 +05:30
a8d46f559b
doc: add demo video 2024-04-05 05:19:51 +05:30
bc2903d34a doc: fix example snippet md 2024-04-05 05:13:02 +05:30
3 changed files with 32 additions and 28 deletions

View File

@ -4,11 +4,17 @@
# Swarnam
A no-frills web playground plugin for Obsidian.
A no-frills web playground plugin for Obsidian. Inspired by [MDN playgrounds](https://developer.mozilla.org/en-US/docs/Web/CSS/grid).
<sup><i>Swarnam (സ്വർണം)</i> means <i>gold</i> in Malayalam.<br/></sup>
<sup>(icon credit: [3dicons](https://3dicons.co))</sup>
<small>(icon credit: [3dicons](https://3dicons.co))</small>
</div>
## Demo
https://github.com/runofthemillgeek/swarnam-obsidian/assets/2759499/333424b3-2f82-4c1e-9e50-68c837227433
## Usage
Install the extension from Obsidian community plugins list (you need to enable this first from
@ -17,39 +23,39 @@ Settings), enable the plugin and then restart Obsidian.
To create a new Swarnam block, you need to open a block code snippet and give it the `swarnam` tag
like so:
```swarnam
<h1>Hello, world</h1>
```
```swarnam
<h1>Hello, world</h1>
```
When you preview this, it'll show the source and render the HTML side-by-side. You can hover on the
top-right and click the `</>` icon to edit the snippet to make some changes.
You can also add CSS and JS by separating them with `---*---` like so:
```swarnam
<h1 id="h1">Hello world</h1>
```swarnam
<h1 id="h1">Hello world</h1>
---*---
---*---
h1 {
font-family: "Manjari";
color: red;
animation: rainbow 5s ease infinite forwards;
}
h1 {
font-family: "Manjari";
color: red;
animation: rainbow 5s ease infinite forwards;
}
@keyframes rainbow {
0% { filter: hue-rotate(0); }
100% { filter: hue-rotate(360deg); }
}
@keyframes rainbow {
0% { filter: hue-rotate(0); }
100% { filter: hue-rotate(360deg); }
}
---*---
---*---
let i = 0;
let i = 0;
setInterval(() => {
h1.textContent = `${["Hello", "Hola", "നമസ്കാരം"][i++ % 3]} Obsidian!`;
}, 1500)
```
setInterval(() => {
h1.textContent = `${["Hello", "Hola", "നമസ്കാരം"][i++ % 3]} Obsidian!`;
}, 1500)
```
This'll render the three snippets on the left side and show the preview of a web page that has all
these 3 blocks injected.

View File

@ -16,9 +16,7 @@ function bytesToBase64(bytes: Uint8Array) {
}
function asBase64(text: string) {
console.log({ text });
const b64 = bytesToBase64(new TextEncoder().encode(text));
console.log(console.log(new TextDecoder().decode(base64ToBytes(b64))));
return b64;
}

View File

@ -2,10 +2,10 @@
"id": "swarnam",
"name": "Swarnam",
"version": "1.0.1",
"minAppVersion": "0.15.0",
"minAppVersion": "1.5.12",
"description": "A no-frills web playground plugin for Obsidian.",
"author": "runofthemillgeek",
"authorUrl": "https://dg.sangeeth.dev",
"fundingUrl": "https://dg.sangeeth.dev",
"fundingUrl": "https://www.buymeacoffee.com/runofthemillgeek",
"isDesktopOnly": true
}
}