• Stars
    star
    362
  • Rank 117,671 (Top 3 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created about 4 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Stack Overflow's Combination Rich Text / Markdown Editor

Stacks-Editor

Stacks-Editor is a combination rich text / markdown editor that powers Stack Overflow's post editing experience.

Usage

Installation

npm install @stackoverflow/stacks-editor

Import via Modules or CommonJS

<div id="editor-container"></div>
import { StacksEditor } from "@stackoverflow/stacks-editor";
// don't forget to include the styles as well
import "@stackoverflow/stacks-editor/dist/styles.css";
// include the Stacks js and css as they're not included in the bundle
import "@stackoverflow/stacks";
import "@stackoverflow/stacks/dist/css/stacks.css";

new StacksEditor(
    document.querySelector("#editor-container"),
    "*Your* **markdown** here"
);

Import via <script> tag

<!--include Stacks -->
<link rel="stylesheet" href="path/to/node_modules/@stackoverflow/stacks/dist/css/stacks.css" />
<!-- include the bundled styles -->
<link
    rel="stylesheet"
    href="path/to/node_modules/@stackoverflow/stacks-editor/dist/styles.css"
/>

<div id="editor-container"></div>

<!-- highlight.js is not included in the bundle, so include it as well if you want it -->
<script src="//unpkg.com/@highlightjs/cdn-assets@latest/highlight.min.js"></script>
<!--include Stacks -->
<script src="path/to/node_modules/@stackoverflow/stacks/dist/stacks.min.js"></script>
<!-- include the bundle -->
<script src="path/to/node_modules/@stackoverflow/stacks-editor/dist/app.bundle.js"></script>

<!-- initialize the editor -->
<script>
    new window.stacksEditor.StacksEditor(
        document.querySelector("#editor-container"),
        "*Your* **markdown** here",
        {}
    );
</script>

Development

  1. Install dependencies with npm i
  2. Build and start using npm start
  3. Point your browser to the address listed in the output - typically http://localhost:8080/

Run Tests

Run all unit tests (no end-to-end tests) using

npm test

Run all end-to-end tests (written in Playwright) using

npm run test:e2e

End-to-end tests need to follow the convention of using someName.e2e.test.ts as their filename. They'll automatically get picked up by the test runner this way.

Browser Bundle analysis

Generate a stats.json file for analysis using

npm run print-stats

You can upload your stats.json file here or here for visualization. See more resources here.

Creating a new release

First, bump the package version and push the commit + tags:

> npm run release
> git push --follow-tags

Next, publish the package (this will run the build step before publishing):

> npm publish

Afterwards, create a GitHub release with the new content from CHANGELOG.md.

More Repositories

1

blackbox

Safely store secrets in Git/Mercurial/Subversion
Go
6,670
star
2

StackExchange.Redis

General purpose redis client
C#
5,889
star
3

dnscontrol

Infrastructure as code for DNS!
Go
3,043
star
4

NetGain

A high performance websocket server library powering Stack Overflow.
C#
933
star
5

Stacks

Stack Overflowโ€™s Design System
Less
610
star
6

wmi

WMI for Go
Go
433
star
7

pagedown

The Markdown editor and converter used on Stack Overflow and the other Stack Exchange sites
JavaScript
419
star
8

StackExchange.DataExplorer

Stack Exchange Data Explorer
JavaScript
353
star
9

MarkdownSharp

Open source C# implementation of Markdown processor, used by Stack Overflow.
C#
246
star
10

stack-blog

Stack Overflow Blog
HTML
238
star
11

StackExchange.Utils

Utility class packages used at Stack Exchange...but on NuGet!
C#
195
star
12

httpunit

httpUnit tests compliance of web and net servers with desired output.
Go
164
star
13

StackExchange.Precompilation

Roslyn based csc.exe and aspnet_compiler.exe replacement with metaprogramming hooks for ASP.NET MVC projects from the pre-DNX era
C#
154
star
14

StackExchange.Metrics

A .NET client to send metrics to a variety of metrics backends
C#
136
star
15

Stacks-Icons

Authoring tools for Stack Overflow's shared icon set.
TypeScript
35
star
16

NRediSearch

C#
31
star
17

stackegg

The core game logic of Stack Overflow's April 1st 2015 game, StackEgg.
C#
30
star
18

mayflower

A simple MS SQL Server database migrator using Node.js and TDS.
JavaScript
26
star
19

StackID

An OpenID provider implemented for the Stack Exchange network, built on top of dotNetOpenAuth.
C#
20
star
20

stackexchange.github.com

Source for stackexchange.github.com
HTML
19
star
21

apca-check

Axe rules to check against APCA bronze and silver+ conformance levels.
TypeScript
18
star
22

unikong

Stack Overflow's April 1, 2016 game
JavaScript
16
star
23

haproxy-kubefigurator

Dynamic haproxy configuration for Kubernetes services
Go
14
star
24

RyuJIT-TailCallBug

Tail Call Parameter Corruption Repro for .Net 4.6
C#
12
star
25

signalfx-powershell

This is a PowerShell wrapper around the SignalFx API
PowerShell
10
star
26

mof

Package mof parses and marshals Managed Object Format (MOF) structures
Go
9
star
27

pat

A wrapper for "puppet agent --test"
Go
9
star
28

stackexchange-superfirewall

A facade for firewall::firewall{} that adds enhanced functionality.
Puppet
7
star
29

browserslist-viewer

Static site to parse and display a browserslist string
TypeScript
6
star
30

stacks-utils

A monorepo containing a collection of Stacks config files and other utilities
JavaScript
6
star
31

Stacks-TagHelpers

A set of .Net Core Tag Helpers for use with Stacks
C#
5
star
32

DesignSprint

This repository was used for building a Stack Overflow Talent exploratory design sprint.
HTML
2
star
33

terraform-provider-stackoverflow

Terraform Provider for Stack Overflow
Go
2
star
34

sre-log-1

1
star
35

marketing-resources

1
star