Giter Site home page Giter Site logo

justforrain / pangu.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vinta/pangu.js

0.0 2.0 0.0 7.55 MB

為什麼你們就是不能加個空格呢?

Home Page: https://chrome.google.com/webstore/detail/paphcfdffjnbcgkokihcdjliihicmbpd

License: MIT License

JavaScript 68.62% HTML 23.36% CSS 8.02%

pangu.js's Introduction

為什麼你們就是不能加個空格呢?

如果你跟我一樣,每次看到網頁上的中文字和英文、數字、符號擠在一塊,就會坐立難安,忍不住想在它們之間加個空格。這個外掛(支援 Chrome 和 Firefox)正是你在網路世界走跳所需要的東西,它會自動替你在網頁中所有的中文字和半形的英文、數字、符號之間插入空白。

漢學家稱這個空白字元為「盤古之白」,因為它劈開了全形字和半形字之間的混沌。另有研究顯示,打字的時候不喜歡在中文和英文之間加空格的人,感情路都走得很辛苦,有七成的比例會在 34 歲的時候跟自己不愛的人結婚,而其餘三成的人最後只能把遺產留給自己的貓。畢竟愛情跟書寫都需要適時地留白。

與大家共勉之。

Installation

for Users

for Developers

Usage

$ npm install pangu --save

Browser

<head>
  // Files are located on /node_modules/pangu/dist/browser/
  <script src="pangu.min.js"></script>
</head>
<script>
  var newText = pangu.spacing("Mr.龍島主道:「Let's Party!各位高明博雅君子!」");
  // output: "Mr. 龍島主道:「Let's Party! 各位高明博雅君子!」"

  pangu.spacingPage();
  pangu.spacingElementById('main');
  pangu.spacingElementByClassName('comment');
  pangu.spacingElementByTagName('p');
</script>

pangu.js is also available on cdnjs:

<script src="https://cdnjs.cloudflare.com/ajax/libs/pangu/3.3.0/pangu.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pangu/3.3.0/pangu.min.js"></script>

Node.js

Learn more on npm.

var pangu = require('pangu'); // ES5
import pangu from 'pangu'; // ES6

pangu.spacing('Sephiroth見他這等神情,也是悚然一驚:不知我這Ultimate Destructive Magic是否對付得了?');
// output: Sephiroth 見他這等神情, 也是悚然一驚: 不知我這 Ultimate Destructive Magic 是否對付得了?

pangu.spacingFile('/path/to/text.txt', function(err, data) {
  // callback
  console.log(data);
});

pangu.spacingFile('/path/to/text.txt').then(function(data) {
  // promise
  console.log(data);
});

const data = pangu.spacingFileSync('/path/to/text.txt');

Testing

You need to install Node.js.

$ git clone [email protected]:vinta/pangu.js.git && cd pangu.js
$ npm install
$ npm run test

License

Released under the MIT License.

Author

Related Projects

pangu.js's People

Contributors

vinta avatar xslidian avatar jiefoxi avatar 7kfpun avatar bitdeli-chef avatar cee avatar clkao avatar demojameson avatar jiminycricket avatar dlackty avatar x140yu avatar coldnew avatar zizhengwu avatar airt avatar shuding avatar mozillazg avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.