Link
Markieren Sie Text und verknüpfen Sie eine Adresse damit. Wenn Sie eine Adresse eingeben, ohne Text auszuwählen, wird die Adresse selbst als Linktext eingefügt. Das Tippen einer http://- oder https://-Adresse und anschließendes Drücken von Leertaste oder Eingabetaste wandelt diese ebenfalls in einen Link um.
Links speichern nur http:, https: und gleichseitige Pfade, die mit . oder / beginnen. Adressen, deren Ursprung nicht eindeutig identifiziert werden kann, wie javascript: oder //example.com, werden abgelehnt. Durch Uploads erstellte Anhangslinks speichern ebenfalls Dateinformationen und können nicht manuell wie gewöhnliche Links erstellt werden.
npm install nabi-noteimport {
createNabiWith, mountSurface, mountToolbar, mountContextToolbar,
mountHints, watchSettle, subscriptWing, highlightWing, linkWing,
mountViewTools,
} from 'nabi-note'
const selected = [
subscriptWing,
highlightWing,
linkWing,
]
const { nabi, registry } = createNabiWith(selected)
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: 'de' })
const settle = watchSettle(document, { surface: content })
const shared = { nabi, registry, surface: content, settle, locale: 'de' }
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()))const selected = wings().use('a').build()CSS-Stile
Stilieren Sie gewöhnliche Links mit .nabi-content a und Anhangslinks separat mit .nabi-content a[data-nabi-file].
.article-body a:not([data-nabi-file]) {
color: var(--nabi-accent);
text-decoration-thickness: .08em;
text-underline-offset: .16em;
}
.article-body a[data-nabi-file] {
display: inline-flex;
gap: .35em;
padding: .25em .55em;
background: var(--nabi-soft);
}Die Teile ::before und ::after von Anhangslinks werden verwendet, um das Dateiicon und die Erweiterung anzuzeigen, daher ist es in der Regel am besten, deren content nicht zu ersetzen oder zu entfernen.