SHIFT + D

Markdown completion

Updated on September 7, 2024Source codeTests

useMarkdownCompletion is an extension that autocompletes markdown notation in a textbox created by useTextbox.

Example

Example source code

Create markdown completion

To start autocompleting markdown, call the useMarkdownCompletion function, which requires one parameter:

Parameter
Type
Required
Description
textbox
Textbox
yes
The return object from useTextbox.
<!-- 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:

Property
Type
Description
segmentedBySpace

The reactive Completeable instance created by useMarkdownCompletion to manage inline markdown autocompletion.

Inline markdown includes:

  • bold
  • italic
  • superscript
  • subscript
  • strikethrough
  • code
  • link
segmentedByNewline

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
Function

A function you can use to autocomplete bold text, i.e. wrap words in **.

italic
Function

A function you can use to autocomplete italic text, i.e. wrap words in _.

superscript
Function

A function you can use to autocomplete superscript text, i.e. wrap words in ^.

subscript
Function

A function you can use to autocomplete subscript text, i.e. wrap words in ~.

strikethrough
Function

A function you can use to autocomplete strikethrough text, i.e. wrap words in ~~.

code
Function

A function you can use to autocomplete code text, i.e. wrap words in `.

link
Function

A function you can use to autocomplete a link.

codeblock
Function

A function you can use to autocomplete a codeblock, i.e. wrap a block of text in ```.

blockquote
Function

A function you can use to programmatically convert one or more

orderedList
Function

A function you can use to autocomplete orderedList text

unorderedList
Function

A function you can use to autocomplete unorderedList text

checklist
Function

A function you can use to autocomplete checklist text

heading
Function

A function you can use to autocomplete heading text

horizontalRule
Function

A function you can use to autocomplete horizontalRule text

IntersectionPopup

Edit doc on GitHub

ON THIS PAGE

Markdown completionExampleCreate markdown completionUse your markdown completion