PHPackages                             zerosonesfun/flarum-preview - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. zerosonesfun/flarum-preview

ActiveFlarum-extension[Parsing &amp; Serialization](/categories/parsing)

zerosonesfun/flarum-preview
===========================

Live preview for the Flarum composer: split panel below editor or eye-button toggle. Single source of truth: textarea (raw Markdown/BBCode).

2.0.9(3mo ago)1160MITJavaScriptPHP &gt;=8.2

Since Mar 10Pushed 3mo agoCompare

[ Source](https://github.com/zerosonesfun/flarum-preview)[ Packagist](https://packagist.org/packages/zerosonesfun/flarum-preview)[ RSS](/packages/zerosonesfun-flarum-preview/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (10)Dependencies (1)Versions (37)Used By (0)

Preview (zerosonesfun/flarum-preview)
=====================================

[](#preview-zerosonesfunflarum-preview)

Live preview for the Flarum composer. **Textarea is always the source of truth** (raw Markdown/BBCode); preview is either a split panel below the editor or a full toggle via the eye button.

How it works
------------

[](#how-it-works)

- **Default (Preview on click OFF)**

    - Composer: top = textarea, bottom = **split preview panel** (server-rendered HTML, debounced). Panel is open by default; tap the header to collapse/expand.
    - Drag header up to expand the preview more.
    - Preview updates as you type (debounce + optional instant triggers).
- **Preview on click ON**

    - **Split view is hidden.** No bottom preview panel.
    - **Eye button** appears in the composer.
    - Reply composer: Flarum’s default preview button is replaced by this one.
    - Click eye → **full preview** (textarea hidden, only rendered HTML). Click again → back to textarea.
- **Settings**

    - **Preview debounce (ms):** Delay before calling `POST /api/preview` (default 300).
    - **Instant triggers:** If ON, preview is requested immediately on certain keystrokes (e.g. closing `**`, `````) as well as after debounce.
    - **Preview on click:** See above; when ON, split view is off and eye toggles full preview.
- **Backend**

    - `POST /api/preview`: body `{ content }` → JSON with rendered HTML (Flarum Formatter).
    - Client uses tokenizer for template detection only; all rendering is server-side.

Developer Notes
---------------

[](#developer-notes)

- **Split view (default):** The composer body is wrapped: textarea in the top portion, a preview panel below. The panel shows server-rendered HTML; you can expand/collapse it by tapping its header.
- **Server preview**: Content is sent to `POST /api/preview` (same pipeline as Flarum’s TextFormatter: Markdown + BBCode + extensions). The extension registers this route and uses Flarum’s `Formatter` to parse and render.
- **Client tokenizer**: A small client-side tokenizer recognizes common Markdown (headings, bold, italic, code, lists, links, images, blockquotes). It is used only to detect **default toolbar templates** (e.g. `[link](https://)`, `**bold**`) and avoid rendering them until the user edits the placeholder.

Install
-------

[](#install)

1. Copy the extension into your Flarum `extensions` folder (or install via Composer when published): ```
    cd /path/to/flarum
    composer require zerosonesfun/flarum-preview:^1.0
    ```

    Or for Flarum 2.0: ```
    cd /path/to/flarum
    composer require zerosonesfun/flarum-preview:^2.0
    ```
2. Clear cache and enable in Admin: ```
    php flarum cache:clear
    ```

    Then **Administration → Extensions → Preview → Enable**.
3. Rebuild frontend assets if your setup requires it (e.g. `php flarum build` if you use Flarum’s build pipeline).

Update/Remove
-------------

[](#updateremove)

```
composer update zerosonesfun/flarum-preview
```

```
composer remove zerosonesfun/flarum-preview
```

License
-------

[](#license)

MIT. See [LICENSE](LICENSE).

Runbook (tests and build)
-------------------------

[](#runbook-tests-and-build)

### Build JS

[](#build-js)

```
cd /path/to/flarum-preview
npm install
npm run build
```

Produces `js/dist/forum.js` and `js/dist/admin.js`.

Repository
----------

[](#repository)

`zerosonesfun/flarum-preview` — [GitHub](https://github.com/zerosonesfun/flarum-preview)

###  Health Score

43

—

FairBetter than 90% of packages

Maintenance81

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

36

Last Release

99d ago

Major Versions

0.20 → 1.0.02026-03-10

1.0.4 → 2.0.02026-03-14

1.0.5 → 2.0.92026-03-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/1388f65f82a8f3fa5e2af06c8dfe0c8a37d74786ccbd02d64ef85f283b0bf210?d=identicon)[zerosonesfun](/maintainers/zerosonesfun)

---

Top Contributors

[![zerosonesfun](https://avatars.githubusercontent.com/u/41351317?v=4)](https://github.com/zerosonesfun "zerosonesfun (29 commits)")

---

Tags

composermarkdownextensionpreviewflarum

### Embed Badge

![Health badge](/badges/zerosonesfun-flarum-preview/health.svg)

```
[![Health](https://phpackages.com/badges/zerosonesfun-flarum-preview/health.svg)](https://phpackages.com/packages/zerosonesfun-flarum-preview)
```

###  Alternatives

[flarum-lang/russian

Russian language pack for Flarum.

12127.5k](/packages/flarum-lang-russian)[flarum-lang/french

French language pack to localize the Flarum forum software plus its official and third-party extensions.

1936.5k](/packages/flarum-lang-french)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
