Ninke

Yana haɗa taƙaitaccen bayani da abun ciki a tubali ɗaya. Idan ka ƙirƙire shi daga sandar kayan aiki, ka fara da shigar da taƙaitaccen bayani sannan ka ci gaba da rubuta abun ciki a ƙasa.

Ana adana matsayin buɗewa da alwatika ya ƙayyade a cikin daftari, kuma ya zama matsayin farko a shafin da aka wallafa. Yayin gyarawa, ana barin abun ciki a buɗe domin a iya gyara shi, amma ƙimar matsayin da aka adana tana nan yadda take.

Fuka-fukai
Nau’in rubutu na asaliTazara
HTMLAna loda edita…
JSONnabi-treeAna loda edita…
Sanya
npm install nabi-note
Lamba
import {
  createNabiWith, mountSurface, mountToolbar, mountContextToolbar,
  mountHints, watchSettle, quoteWing, detailsWing, codeWing,
  mountViewTools,
} from 'nabi-note'

const selected = [
  quoteWing,
  detailsWing,
  codeWing,
]
const { nabi, registry } = createNabiWith(selected)

// Bring your own highlighter (Prism, highlight.js, Shiki, …) — the wing stays as it is
// and only the attach is swapped (`makeCodeAttach` ships from the same door)
// { ...codeWing, attach: makeCodeAttach({ highlight: (source, lang) => [{ text: source }] }) }

const root = document.querySelector('.nabi')!
const content = document.querySelector('.nabi-content')!

// The locale also sets the direction — Arabic and Urdu run right to left
mountSurface({ nabi, registry, root: content, locale: 'ha' })

const settle = watchSettle(document, { surface: content })
const shared = { nabi, registry, surface: content, settle, locale: 'ha' }
const toolbar = mountToolbar({ ...shared, root: document.querySelector('#toolbar')! })
const context = mountContextToolbar({ ...shared, root: document.querySelector('#context')! })
mountHints({ toolbar, context, root, surface: content })
// The preview and fullscreen buttons — they stand their own box at the end of the row
mountViewTools({ ...shared, root, container: document.querySelector('#toolbar')! })

// on every change — hook up your own code here
// nabi.onChange(() => user_callback(nabi.getHtml()))
ts
const selected = wings().use('details').build()

Tsarin CSS

Za ka iya yi wa tubalin ninkewa ado da .nabi-content details, take kuma da .nabi-content details > summary.

css
.article-body details {
  padding: .75rem 1rem;
  border: 1px solid var(--nabi-line);
  border-radius: var(--nabi-radius);
  background: var(--nabi-soft);
}

.article-body details > summary { cursor: pointer; font-weight: 700; }
.article-body details[open] > summary { margin-block-end: .75rem; }

Sifar open ita ce matsayin buɗewa na farko da marubuci ya adana. CSS na iya yi wa wannan matsayi ado, amma yana da kyau kada ya canza matsayin da karfi.