https://github.com/fennecdjay/cmojify
https://github.com/fennecdjay/cmojify
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/fennecdjay/cmojify
- Owner: fennecdjay
- License: gpl-3.0
- Created: 2020-09-22T12:16:51.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-04-06T15:26:39.000Z (about 5 years ago)
- Last Synced: 2023-06-19T13:07:18.327Z (about 3 years ago)
- Language: C
- Homepage:
- Size: 885 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# Cmojify

## What is it?
Cmojify started as a challenge fennecdjay did to create a textual API for emojis in under 10 minutes.
After some improvements, it is now a library that allows you to transform any "cmoji" string into a processed one suitable for printing and other purposes.
## How do I use it?
The API is a singular function, `cmojify`. This takes 3 parameters: an output buffer, its length, and the input "cmoji" string.
The first two parameters can be passed with:
```c
char output_buffer[whatever length];
cmojify(output_buffer, sizeof(output_buffer), __);
```
The last parameter is just the cmoji source string.
```c
char output_buffer[whatever length];
cmojify(output_buffer, sizeof(output_buffer), "Cmojify is :star:!");
```
## What's a "cmoji" string?
The strings given to the `cmojify` function are normal C strings, but they have a special syntax. If an emoji is named between two `:` then it is replaced with that emoji. In the example above, `:art:` is replaced with `🎨`.
You can escape `:` using a backslash (two backslashes in a C string), and you can escape backslashes with another backslash (four backslashes in a C string).
## Using Cmojify in your own project
### Using Cmojify as a stand-alone library
To use Cmojify as a static library, simply run:
```sh
git clone https://github.com/fennecdjay/cmojify
cd cmojify
make
```
This will build the library `libcmojify.a`.
### Using Cmojify in an existing project
To add Cmojify to an existing project, make use of git submodules:
```sh
git submodule add https://github.com/fennecdjay/cmojify
```