0.2.1 • Published 4 years ago

beauty.js v0.2.1

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

beauty.js

Build Status Coverage Downloads Downloads npm version dependencies dev dependencies License

Make the web more beautiful

Use it with NPM

Install it via npm:

npm install beauty.js

And include in your project:

import beautyJS from 'beauty.js';

// default usage
beautyJS.beauty('text')
beautyJS.beauty(Element)

// custom usage of TextFormat
const format = new beautyJS.TextFormat({
  nouns: ['Apple', 'IOS']
});
format.updateNouns(['Apple', 'IOS', 'Android'])
format.formatText('text')
// all tags must closed like: <tag /> or <tag></tag>
format.formatHTMLText('<p><image src="url"/>text</p>')
// all tags must closed like: <tag></tag> and no nest
format.formatHTML('<span>text</span><span>another text</span>')

// custom usage of ParagraphFormat
const p = new beautyJS.ParagraphFormat(Element, {
    disableHanging: true, // 取消标点悬挂
    format: new beautyJS.TextFormat(), // 文本格式化
    disableFormat: true, // 禁用文本格式化
    clamp: 3,// 最多显示行数
    strict: false // 是否开启严格排版模式,默认关闭。开启后会移除【】中的内容,"" “” 替换为 「」,以「」开头,直接去掉符号,• 替换为 ·
})
// clamp
p.clamp(10) //设置展开行数

// remember destroy to avoid memory leaks
p.clear()

Use it with Script Link

<head>
  // Files are located on /node_modules/beauty.js/build/
  <script src="beauty.min.js"></script>
</head>
<script>
  beautyJS.beauty('text')
  ...
</script>

License

MIT

0.2.1

4 years ago

0.2.0

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

6 years ago

0.1.0

6 years ago