npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

emily-editor

v0.9.5

Published

React editor component for LMLs, like Markdown or Asciidoc. The focus of the project is to provide fluent efficient interface for advanced users, who are familliar with using IDE or coding text editors.

Downloads

10

Readme

Emily

Travis build Dependencies Status Dev-dependencies Status npm version

Emily is a React editor component for LMLs, like Markdown or Asciidoc. The focus of the project is to provide fluent efficient interface for advanced users, who are familliar with using IDE or coding text editors.

About Emily

Emily is an editor for LML document formats, currently supporting few languages. Editor works with a document-format abstraction and new modules can be added to make use of existing features:

  • Syntax highlight
  • Live document preview
    • Review the result as you type in split screen view or just browse the preview
  • Outline preview
    • Section lookup in source code
    • Section reordering -- drag & drop whole sections
  • Command palette
    • Make use of a command palette you know from coding editors
  • Autosave
    • Session is stored in localStorage, retrieved when lost.

Emily editor is part of an implementation for the Git-based Wiki System and its UI for the prototype has been developed in cource UI Design on the faculty.

Install

npm install --save emily-editor

Usage

  1. Include node_modules/emily-editor/dist/style.css
  2. Include node_modules/emily-editor/dist/script.js
  3. Use component:
import Emily from 'emily-editor'
// ...

ReactDOM.render(
  <Emily />,
  document.getElementById('container')
);

For examples, see pages

Props

content

Initial content of the editor

language

Language mode object. You can use generateMode to create a mode from existing modules.

import Emily, { generateMode } from 'emily-editor'
// ...

ReactDOM.render(
  <Emily language={generateMode(/*...*/)} />,
  document.getElementById('container')
);

listFiles(pfx)

List available relative files with path prefix pfx. Returns a Array<String> in a Promise.

This can be used for autosuggestions by a mode.

width

Lock editor's width and vorbid it to fill the container.

height

Lock editor's height and vorbid it to fill the container.

Methods

getValue

Return current value of the editor.

generateMode(input)

Input can be either:

  • name of the mode, e.g. asciidoc
  • any file path, e.g. foo/bar/baz.adoc

As a result a language mode is generated.

  1. If the name or the extension matches an existing LML mode, a proper full-featured mode is generated.
  2. If the name or the extension matches a mode supported by Ace editor, no special features for LML are provided, but editor features syntax highlight.
  3. Otherwise a plaintext editor is delivered. No syntax highlight.

Examples

Here are some examples of using the editor with generateMode function.

// asciidoc mode
<Emily language={generateMode('x.adoc')}>
<Emily language={generateMode('asciidoc')}>
<Emily language={generateMode('/xxx/weee.adoc')}>

// markdown mode
<Emily language={generateMode('markdown')}>
<Emily language={generateMode('a/b/c/d/foo.md')}>

// (unsupported) js mode
// only syntax highlight, missing features
<Emily language={generateMode('javascript')}>
<Emily language={generateMode('test.js')}>

// unrecognized mode
// working in plaintext mode
<Emily language={generateMode('foo/bar/baz')}>
<Emily language={generateMode('thisisnotanameofanymode')}>

Language modes

Take a look at asciidoc mode example.

name (string)

  • name of the mode

convert (func)

  • converting function to html from the raw markup

lineSafeInsert (func)

  • insert content in the line of markup without distorting the markup
  • the more lines you can cover the better
  • it is necessary to cover heading lines

postProcess (func)

  • modify preview DOM before render

renderJsxStyle (func)

  • add styles for preview

excludeOutlineItem (func)

  • exclude DOM Element from the outline

previewClassName (string)

  • set the CSS classname for the prevew container

Online demo

https://emily-editor.herokuapp.com/

License

Emily editor is licenced under the BSD License.