Markdown completion
Updated on September 7, 2024Source codeTests
useMarkdownCompletion
is an extension that autocompletes markdown notation in a textbox created by useTextbox
.
Example
Create markdown completion
To start autocompleting markdown, call the useMarkdownCompletion
function, which requires one parameter:
<!-- MyComponent.vue -->
<template>...</template>
<script setup>
import { useTextbox, useMarkdownCompletion } from '@baleada/vue-features'
const textbox = useTextbox(),
markdownCompletion = useMarkdownCompletion(textbox)
</script>
Use your markdown completion
useMarkdownCompletion
returns markdownCompletion
βan object with tools you can use to perform and monitor autocompletion.
Here's a breakdown of that object:
segmentedBySpace
Completeable
)The reactive Completeable
instance created by useMarkdownCompletion
to manage inline markdown autocompletion.
Inline markdown includes:
- bold
- italic
- superscript
- subscript
- strikethrough
- code
- link
segmentedByNewline
Completeable
)The reactive Completeable
instance created by useMarkdownCompletion
to manage block-level markdown autocompletion.
Block-level markdown includes:
- codeblock
- blockquote
- ordered list
- unordered list
- checklist
- heading
- horizontal rule
bold
A function you can use to autocomplete bold text, i.e. wrap words in **
.
italic
A function you can use to autocomplete italic text, i.e. wrap words in _
.
superscript
A function you can use to autocomplete superscript text, i.e. wrap words in ^
.
subscript
A function you can use to autocomplete subscript text, i.e. wrap words in ~
.
strikethrough
A function you can use to autocomplete strikethrough text, i.e. wrap words in ~~
.
code
A function you can use to autocomplete code text, i.e. wrap words in `
.
link
A function you can use to autocomplete a link.
codeblock
A function you can use to autocomplete a codeblock, i.e. wrap a block of text in ```
.
blockquote
A function you can use to programmatically convert one or more
orderedList
A function you can use to autocomplete orderedList text
unorderedList
A function you can use to autocomplete unorderedList text
checklist
A function you can use to autocomplete checklist text
heading
A function you can use to autocomplete heading text
horizontalRule
A function you can use to autocomplete horizontalRule text