Skip to content

Commit

Permalink
Merge pull request #50 from danielhaim1/master
Browse files Browse the repository at this point in the history
General improvements, and security fixes
  • Loading branch information
davidmerfield authored Oct 8, 2019
2 parents f1ed6f1 + a566c54 commit 4ae6527
Show file tree
Hide file tree
Showing 25 changed files with 5,843 additions and 1,641 deletions.
53 changes: 46 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,54 @@
# Exclude directories
build/*
tests/*
logs
*.log
pids
*.pid
*.seed
node_modules
build

# Ignore ruby files
.ruby-version
.bundle
vendor/cache
vendor/bundle

# Numerous always-ignore extensions
*.swp
*.eot
*.svg
*.ttf
*.woff
*.woff2
*.diff
*.err
*.log
*.orig
*.rej
*.swo
*.vi
*.zip
*~
*.seed
*.pid

tests/*
# OS or Editor folders
._*
.cache
.DS_Store
.idea
.project
.settings
.tmproj
*.esproj
*.sublime-project
*.sublime-workspace
nbproject
Thumbs.db

# Komodo
.komodotools
*.komodoproject

# grunt-contrib-sass cache
.sass-cache

# Folders to ignore
bower_components
node_modules
42 changes: 32 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Demo](http://i.imgur.com/adsiz94.gif)](https://blot.im/typeset)
[![Demo](http://i.imgur.com/adsiz94.gif)](https://typeset.lllllllllllllllll.com/)

**[Typeset](https://blot.im/typeset)** is an html pre-proces­sor for web ty­pog­ra­phy. It uses no client-side JavaScript but gives you hang­ing punc­tu­a­tion, soft hy­phen in­ser­tion, op­ti­cal mar­gin out­dents, small-caps con­ver­sion and punctuation substitution. See the results on [the demo](https://blot.im/typeset). The library is idempotent and runs on the server using Node – I'll adapt it to work on the client soon. The processed HTML & CSS [renders correctly in IE5](http://i.imgur.com/vVGtD3V.png) and [without any CSS](http://i.imgur.com/ITM0bcG.png)!
**[Typeset](https://typeset.lllllllllllllllll.com/)** is an html pre-proces­sor for web ty­pog­ra­phy. It uses no client-side JavaScript but gives you hang­ing punc­tu­a­tion, soft hy­phen in­ser­tion, op­ti­cal mar­gin out­dents, small-caps con­ver­sion and punctuation substitution. See the results on [the demo](https://typeset.lllllllllllllllll.com/). The library is idempotent and runs on the server using Node – I'll adapt it to work on the client soon. The processed HTML & CSS [renders correctly in IE5](http://i.imgur.com/vVGtD3V.png) and [without any CSS](http://i.imgur.com/ITM0bcG.png)!

```javascript
npm install typeset
Expand All @@ -9,29 +9,51 @@ npm install typeset
##### Usage

```javascript
var typeset = require('typeset');
var html = '<p>"Hello," said the fox.</p>';
var output = typeset(html);
const typeset = require('typeset');
const html = '<p>"Hello," said the fox.</p>';
const output = typeset(html);
```

Then tweak [typeset.css](https://blot.im/typeset/demo/typeset.css) to match the metrics of your font and include it on your page.
Then tweak [typeset.css](https://github.com/davidmerfield/Typeset/blob/master/demo/source/typeset.css) to match the metrics of your font and include it on your page.

Typeset.js is available as a plugin for [grunt](https://github.com/mobinni/grunt-typeset) and [gulp](https://github.com/lucasconstantino/gulp-typeset).
```css
/* Small caps */
/*.small-caps {font-variant: small-cap/*s;}*/

/* Double quote (") marks */
.pull-double{margin-left:-.46em}
.push-double{margin-right:.46em}

/* Single quote (') marks */
.pull-single{margin-left:-.27em}
.push-single{margin-right:.27em}

/* Optical margin alignment for particular letters */
.pull-T, .pull-V, .pull-W, .pull-Y {margin-left: -0.07em}
.push-T, .push-V, .push-W, .push-Y {margin-right: 0.07em}

.pull-O, .pull-C, .pull-o, .pull-c {margin-left: -0.04em}
.push-O, .push-C, .push-o, .push-c {margin-right: 0.04em}

.pull-A {margin-left: -0.03em}
.push-A {margin-right: 0.03em}
```

Typeset.js is available as a plugin for [Grunt](https://github.com/mobinni/grunt-typeset) and [gulp](https://github.com/lucasconstantino/gulp-typeset).

##### Options

You can pass an options object to influence how your HTML is typeset:

```javascript
var options = {
const options = {
ignore: '.skip, #anything, .which-matches', // string of a CSS selector to skip
only: '#only-typeset, .these-elements' // string of a CSS selector to only apply typeset,
disable: ['hyphenate'], // array of features to disable
};
```

##### Disableable features

The following features may be disabled:

- `quotes`
Expand Down Expand Up @@ -98,7 +120,7 @@ This software is dedicated to the public domain and licensed under [CC0](https:/

##### Building locally

Clone this repo then fetch its dependencies using ```npm install```. You can then edit the code in ```/src```.
Clone this repo then fetch its dependencies using `npm install`. You can then edit the code in `/src`.

##### To Do
* Add a build file
Expand Down
Loading

0 comments on commit 4ae6527

Please sign in to comment.