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

mdash

v0.1.3

Published

Wrapper for typographer mdash (EMT, written by Evgeny Muravjev)

Downloads

17

Readme

mdash

NPM version Dependency status devDependency status

A node.js wrapper for the EMT typographer, written by Evgeny Muravjev.

Installation

$ npm install mdash

Examples

JavaScript

var mdash = require('mdash');

var text = 'May "the force" be with you.\n"The force" is a magical power that gives people strength. This phrase is kind of a way of saying "good luck".';

mdash.apply(text, function(error, result) {
  if (error) {
    throw new Error(error);
  }

  // result is a typographic text
  console.log(result);
});

CoffeeScript

mdash = require 'mdash'

text = 'May "the force" be with you.\n"The force" is a magical power that gives people strength. This phrase is kind of a way of saying "good luck".'

mdash.apply text, (error, result) ->
  throw new Error error if error

  # result is a typographic text
  console.log result

API

  • endpoint=
  • apply(text[, options], callback)

By default endpoint set to official API (http://mdash.ru/api.v1.php), but it does not support typographer options or multiple texts. You can change endpoint to yours. For example, you can run mdash-service and send all request to it.

mdash-service extras

API extras have different default options, can enable/disable options and accept not only text, but array and object of texts.

var texts = {
  title: 'May "the force" be with you.',
  text: '"The force" is a magical power that gives people strength. This phrase is kind of a way of saying "good luck".'
};

mdash.apply(texts, function(error, result) {
  if (error) {
    throw new Error(error);
  }

  // result is an object with title and text keys
  console.log(result);
});

EMT options list:

Quote.quotes
Quote.quotation
Dash.to_libo_nibud
Dash.iz_za_pod
Dash.ka_de_kas
Nobr.super_nbsp
Nobr.nbsp_in_the_end
Nobr.phone_builder
Nobr.ip_address
Nobr.spaces_nobr_in_surname_abbr
Nobr.nbsp_celcius
Nobr.hyphen_nowrap_in_small_words
Nobr.hyphen_nowrap
Nobr.nowrap
Symbol.tm_replace
Symbol.r_sign_replace
Symbol.copy_replace
Symbol.apostrophe
Symbol.degree_f
Symbol.arrows_symbols
Symbol.no_inches
Punctmark.auto_comma
Punctmark.hellip
Punctmark.fix_pmarks
Punctmark.fix_excl_quest_marks
Punctmark.dot_on_end
Number.minus_between_nums
Number.minus_in_numbers_range
Number.auto_times_x
Number.simple_fraction
Number.math_chars
Number.thinsp_between_number_triads
Number.thinsp_between_no_and_number
Number.thinsp_between_sect_and_number
Date.years
Date.mdash_month_interval
Date.nbsp_and_dash_month_interval
Date.nobr_year_in_date
Space.many_spaces_to_one
Space.clear_percent
Space.clear_before_after_punct
Space.autospace_after
Space.bracket_fix
Abbr.nbsp_money_abbr
Abbr.nobr_vtch_itd_itp
Abbr.nobr_sm_im
Abbr.nobr_acronym
Abbr.nobr_locations
Abbr.nobr_abbreviation
Abbr.ps_pps
Abbr.nbsp_org_abbr
Abbr.nobr_gost
Abbr.nobr_before_unit_volt
Abbr.nbsp_before_unit
OptAlign.all
OptAlign.oa_oquote
OptAlign.oa_obracket_coma
OptAlign.oa_oquote_extra
OptAlign.layout
Text.paragraphs
Text.auto_links
Text.email
Text.breakline
Text.no_repeat_words
Etc.unicode_convert

You can enable or disable option like this:

var options = {
  'Text.paragraphs': 'off',
  'Text.breakline': 'off',
  'Etc.unicode_convert': 'on'
};

mdash.apply(text, options, function(error, result) {
  if (error) {
    throw new Error(error);
  }

  console.log(result);
});

Author

License

The MIT License, see the included license.md file.