Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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`).