Download the PHP package webcito/bs-markdown-editor without Composer

On this page you can find all versions of the php package webcito/bs-markdown-editor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package bs-markdown-editor

bs-markdown-editor

bs-markdown-editor is a lightweight jQuery Markdown editor plugin that integrates seamlessly with Bootstrap 6. It not only uses Bootstrap for its UI but also leverages Bootstrap utility classes for features like text alignment and responsive images within the Markdown content.

Requirements

Installation

With Composer:

Or include the files manually from dist/.

Or use a GitHub CDN (replace VERSION with a release tag):

Usage

For a complete Markdown sample covering all standard toolbar actions, see example.md.

Options

Option Type Default Details
minHeight number 220 Minimum editor height in pixels. Applied to all surfaces and used as a lower bound for height.
height number \| null 500 Initial editor height in pixels. If null, the editor follows the content.
preview boolean true Legacy preview availability flag. If false, preview is removed from the resolved modes list.
mode 'editor' \| 'html' \| 'preview' 'editor' Initial mode after initialization. Invalid values fall back to the first allowed modes entry.
modes string \| string[] ['editor', 'preview'] Allowed modes and dropdown order. Supported values are editor, html, and preview. A string may be a single mode or comma-separated list. If only one mode is allowed, no mode dropdown is rendered.
resize boolean \| 'vertical' \| 'both' false Enables mouse-based resizing on the visible contenteditable surface. true maps to 'vertical'.
size 'sm' \| 'lg' \| null null Button group size variant. Maps to Bootstrap 6 button-group size classes.
btnClass string 'border-0' Bootstrap 6 button style class used by toolbar buttons (example: btn-outline theme-inverse, btn-solid theme-secondary).
wrapperClass string \| null null Additional class name(s) applied to the editor wrapper. The plugin always keeps its internal wrapper class .bs-markdown-editor and appends your classes on top.
actions 'all' \| string[] 'all' Toolbar action filter. 'all' renders all actions. Array mode renders only matching action keys and keeps array order. Unknown keys are ignored.
customActions object \| array {} Additional toolbar actions. run(context) receives the editor context, including textarea, editable, and helpers.
emojiPickerAutoLoad boolean false Automatically loads the bs-emoji-picker script (via GitHub CDN as fallback) when the emoji action is rendered and the picker plugin is not already loaded.
emojiPickerSrc string \| string[] \| null null Optional custom script URL(s) for bs-emoji-picker. When omitted, the editor tries the GitHub CDN automatically.
shortcuts object {...} Keyboard shortcuts mapping action keys to shortcut strings (e.g., 'bold': 'ctrl+b'). Supports ctrl+ and ctrl+shift+ modifiers.
lang string auto Reserved for compatibility. Locale selection is now handled by preloaded locale files plus translations overrides.
translations object {} Deep-merged text overrides for labels, prompts, placeholders, callout labels/titles, modal text, and preview messages. Merge order: built-in English defaults -> window.bsMarkdownEditorTranslations (if loaded) -> this option.

Action Keys (actions option)

Key Purpose
bold Wrap selection with **...**
italic Wrap selection with _..._
textStyles Dropdown: strikethrough / underline
clearFormatting Remove inline Markdown formatting from the selection
heading Dropdown: H1-H6
ul Unordered list
ol Ordered list
indent Indent selected lines (sublists)
outdent Outdent selected lines
quote Prefix lines with >
link Insert markdown link
image Open image modal and insert markdown image
callout Open the callout modal and insert a Markdown callout block
details Insert a collapsible details block
definitionList Insert an HTML definition list block
code Inline code
codeBlock Fenced code block
hr Horizontal rule (---)
taskList Task list (- [ ] ...)
toggleTask Toggle selected task list items
table Open table modal and insert markdown table
emoji Open emoji picker
undo Undo via plugin history
redo Redo via plugin history
alignment Insert alignment HTML tags using Bootstrap utility classes (text-start, text-center, text-end or inline style for justify)
preview Legacy preview toggle action. Mode switching is rendered as a dropdown when modes allows more than one mode.

Shortcuts

The editor supports keyboard shortcuts for common actions. Default shortcuts are:

Action Shortcut
Bold Ctrl + B
Italic Ctrl + I
List Ctrl + L
Num list Ctrl + Shift + O
Quote Ctrl + Q
Code Ctrl + K
Link Ctrl + Shift + L
Image Ctrl + Shift + I
Undo Ctrl + Z
Redo Ctrl + Y
Preview Ctrl + P
Horizontal rule Ctrl + H
Task list Ctrl + Shift + T
Toggle task Ctrl + Shift + M
Strikethrough Ctrl + Shift + S
Underline Ctrl + Alt + U
Callout Ctrl + Shift + C
Details Ctrl + Shift + D
Definition list Ctrl + Shift + U
Subscript Ctrl + Shift + B
Superscript Ctrl + Shift + P
Code block Ctrl + Shift + K
Emoji Ctrl + E
Heading 1-6 Ctrl + Shift + 1-6
Align Left Ctrl + Alt + L
Align Center Ctrl + Alt + C
Align Right Ctrl + Alt + R
Align Justify Ctrl + Alt + J

Shortcuts can be customized or disabled via the shortcuts option. On macOS, Cmd is used instead of Ctrl.

Custom Actions

customActions adds project-specific controls to the toolbar. It accepts either an object keyed by action name or an array of action objects.

Use context.helpers.replaceSelection(...) when a custom action should insert text at the cursor or replace selected text. Directly appending to textarea.value always writes at the end and bypasses the current selection.

Custom Action Options

Property Type Details
title string Button title/tooltip. Also used as fallback button text when no icon is set.
icon string Bootstrap Icons class, for example bi-eye-slash.
run function Called as run(context) for default button actions.
render function Called as render(context) when the action renders its own toolbar UI. Must return an element, jQuery object, or HTML.
position string Use 'right' to append the action to the right toolbar group. Defaults to the left toolbar group.
buttonClass string Optional Bootstrap class override for the generated run button.
enabled boolean Set to false to skip rendering the custom action.

Custom Action Context

Property Details
key Custom action key.
textarea / editable Underlying textarea and visible contenteditable editor elements.
$editable, $wrapper, $toolbar, $toolbarLeft, $toolbarRight jQuery references for editor UI integration.
helpers Editor helper API, including getSelection, replaceSelection, and syncTextareaFromEditable.
settings Resolved editor settings.
buttonClassBase / toolbarButtonClass / navButtonClass / groupSizeClass Toolbar classes matching the current editor configuration. toolbarButtonClass and navButtonClass include the plugin's toolbar padding class for the Bootstrap md breakpoint only.

For default run(context) buttons, the editor synchronizes the visible selection before calling run. If you render custom interactive UI with render(context), capture the editor selection before your UI steals focus.

Advanced: Emoji Picker

The editor uses the dependency thomasdev-de/bs-emoji-picker for the emoji toolbar action. To use the emoji picker, you must manually include the script on your page:

When the script is present, the emoji action is automatically added to the toolbar (if enabled in actions). If the script is not loaded, the emoji button will not be rendered by default.

If you want the editor to attempt to load the script automatically when needed, set the emojiPickerAutoLoad option to true. When enabled, it attempts to load the script from the following sources (in order):

  1. Any URLs provided via the emojiPickerSrc option.
  2. GitHub CDN: https://cdn.jsdelivr.net/gh/ThomasDev-de/[email protected]/dist/bs-emoji-picker.min.js

If you want to exclude the emoji action from the toolbar entirely, use the actions filter.

Methods

Method Signature Returns Description
mode mode() 'editor' \| 'html' \| 'preview' Get current mode.
mode mode('editor' \| 'html' \| 'preview') jQuery collection Set mode for all matched editors.
val val() string Get current textarea value.
val val(string) jQuery collection Set value for all matched editors. Triggers change events.

Examples:

Direct updates on the underlying textarea are mirrored into the visible editor as well:

Static Methods

These helpers are available directly on $.bsMarkdownEditor and are not bound to a specific editor instance.

Method Signature Returns Description
toHtml toHtml(markdown) string Converts Markdown to the same HTML used by the built-in preview renderer.
toMarkdown toMarkdown(html) string Converts HTML back to Markdown for common editor output such as headings, lists, links, images, tables, blockquotes, code, and task lists.

Example:

Events

Event Fired When Payload
ready.bs.markdown-editor Plugin finished initialization { mode, value, api }
change.bs.markdown-editor Any content change (user, toolbar, API, history, external sync) { source, value }
userChange.bs.markdown-editor User-initiated content change inside the editor (typing, paste, toolbar actions, undo/redo) { source, value }
modeChange.bs.markdown-editor Mode changed between editor/html/preview { mode, previousMode, source }
scroll.bs.markdown-editor Editor or HTML source was scrolled (throttled) { scrollTop, scrollLeft, scrollHeight, clientHeight, mode }
any.bs.markdown-editor Any plugin event above fired { eventName, payload }

Notes

Locales

By default, the plugin ships with English UI text.
To use another language, load one of the files from dist/locale/ before bs-markdown-editor.js.

Locale files set window.bsMarkdownEditorTranslations, which is deep-merged into the built-in English defaults. They include action labels, placeholders, modal text, and callout type labels/titles.

Support this project

If this project helps you, feel free to support its development:

☕ Buy me a coffee via PayPal


All versions of bs-markdown-editor with dependencies

PHP Build Version
Package Version
Requires components/jquery Version ^3
twbs/bootstrap Version ^v6.0.0-alpha.1
twbs/bootstrap-icons Version ^1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package webcito/bs-markdown-editor contains the following files

Loading the files please wait ...