Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ggrossetie/asciidoctor-emoji
Asciidoctor.js extension to add emoji in your document!
https://github.com/ggrossetie/asciidoctor-emoji
asciidoctor emoji extension javascript
Last synced: 18 days ago
JSON representation
Asciidoctor.js extension to add emoji in your document!
- Host: GitHub
- URL: https://github.com/ggrossetie/asciidoctor-emoji
- Owner: ggrossetie
- License: mit
- Created: 2018-11-25T23:02:17.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2023-09-04T09:07:23.000Z (about 1 year ago)
- Last Synced: 2024-10-11T20:15:17.260Z (about 1 month ago)
- Topics: asciidoctor, emoji, extension, javascript
- Language: JavaScript
- Size: 886 KB
- Stars: 7
- Watchers: 2
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# :rocket: Asciidoctor Emoji Extension
[![Build](https://github.com/Mogztter/asciidoctor-emoji/actions/workflows/build.yml/badge.svg)](https://github.com/Mogztter/asciidoctor-emoji/actions/workflows/build.yml)
[![npm version](https://img.shields.io/npm/v/asciidoctor-emoji)](https://www.npmjs.com/package/asciidoctor-emoji)An extension for [Asciidoctor.js](https://github.com/asciidoctor/asciidoctor.js) that turns `emoji:heart[]` into :heart: !
## Install
### Node.js
Install the dependencies:
$ npm i @asciidoctor/core asciidoctor-emoji
Create a file named `emoji.js` with following content and run it:
```javascript
const asciidoctor = require('@asciidoctor/core')()
const emoji = require('asciidoctor-emoji')const input = 'I emoji:heart[1x] Asciidoctor.js!'
emoji.register(asciidoctor.Extensions)
console.log(asciidoctor.convert(input)) // <1>const registry = asciidoctor.Extensions.create()
emoji.register(registry)
console.log(asciidoctor.convert(input, {'extension_registry': registry})) // <2>
```
<1> Register the extension in the global registry
<2> Register the extension in a dedicated registry### Browser
Install the dependencies:
$ npm i @asciidoctor/core asciidoctor-emoji
Create a file named `emoji.html` with the following content and open it in your browser:
```html
var input = 'I emoji:heart[1x] Asciidoctor.js!'var asciidoctor = Asciidoctor()
var emoji = AsciidoctorEmojiconst registry = asciidoctor.Extensions.create()
emoji.register(registry)
var result = asciidoctor.convert(input, {'extension_registry': registry})
document.getElementById('content').innerHTML = result
```
<1> Register the extension in the global registry
<2> Register the extension in a dedicated registry## Usage
Use `emoji:` followed by the name of your emoji (and don't forget the square brackets). For instance `wink`:
```adoc
emoji:wink[]
```Additionally you can configure the size of an `emoji`.
By default, the size is 24px but you can use one of the following:* `1x` (17px)
* `lg` (24px)
* `2x` (34px)
* `3x` (50px)
* `4x` (68px)
* `5x` (85px)If you want a really big :bear:, use:
```adoc
emoji:bear[5x]
```You can also specify a size in pixel :tada:
```adoc
emoji:tada[42px]
```## How ?
This extension is using [Twemoji from Twitter](https://blog.twitter.com/developer/en_us/a/2014/open-sourcing-twitter-emoji-for-everyone.html).
The `emoji` inline macro is converted into an `` that points to a remote SVG:```adoc
emoji:beetle[]
``````html
```