Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fiatjaf/svelte-asciidoc
AsciiDoc parser to customizable Svelte components
https://github.com/fiatjaf/svelte-asciidoc
asciidoc nostr svelte
Last synced: about 2 months ago
JSON representation
AsciiDoc parser to customizable Svelte components
- Host: GitHub
- URL: https://github.com/fiatjaf/svelte-asciidoc
- Owner: fiatjaf
- License: mit
- Created: 2024-06-12T19:59:19.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-10-25T13:11:36.000Z (2 months ago)
- Last Synced: 2024-10-25T21:00:06.875Z (about 2 months ago)
- Topics: asciidoc, nostr, svelte
- Language: Svelte
- Homepage:
- Size: 71.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE
Awesome Lists containing this project
README
= svelte-asciidoc
[source,bash]
----
npm install svelte-asciidoc
----This library takes a blob of https://asciidoc.org/[AsciiDoc] text renders it as a collection
of Svelte components that can be customized. Similar to https://github.com/oxidecomputer/react-asciidoc
and https://github.com/pablo-abc/svelte-markdown (but don't use Markdown ever again in your life, please,
use just AsciiDoc).[source,html]
----import SvelteAsciidoc from 'svelte-asciidoc'
----Now suppose you want to make bold text also look bluey. Create a new component `CustomBold.svelte`:
[source,html]
----
----and then pass it to `SvelteAsciidoc`:
[source,diff]
----
import SvelteAsciidoc from 'svelte-asciidoc'
+import CustomBold from './CustomBold.svelte'
----You can also apply the default https://cdnjs.cloudflare.com/ajax/libs/asciidoctor.js/1.5.9/css/asciidoctor.min.css[asciidoctor.css]
stylesheet and it should work with the default classes this library generates.'''
See link:src/routes/+page.svelte[] for another usage example.
See link:src/lib/renderers[] for all higher-level customizable components and their default implementations (these must be specified with the parameter `customRenderers={}`, while `naturalRenderers={}` is for simple stuff like `a`, `em`, `sup`, `sub`, `strong`).