├── .gitignore ├── marked-emojis.png ├── scripts-maker.js └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | downloader.sh 2 | emojis.json 3 | preprocessor.sh 4 | emojis 5 | -------------------------------------------------------------------------------- /marked-emojis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyganch/marked-emojis/HEAD/marked-emojis.png -------------------------------------------------------------------------------- /scripts-maker.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var fs = require('fs'); 4 | var emojis = require('./emojis.json'); 5 | 6 | var PREPROCESSOR_FILE = 'preprocessor.sh'; 7 | var DOWNLOADER_FILE = 'downloader.sh'; 8 | 9 | var preprocessorData = ['#!/bin/bash', 'sed \'']; 10 | var downloaderData = ['#!/bin/bash', 'rm -rf emojis', 'mkdir emojis']; 11 | 12 | for (var emoji in emojis) { 13 | var url = emojis[emoji]; 14 | var filename = getFilenameFromUrl(url); 15 | 16 | addDataToPreprocessor(emoji, filename); 17 | addDataToDownloader(url, filename); 18 | } 19 | 20 | preprocessorData.push(' \''); 21 | 22 | fs.writeFileSync(PREPROCESSOR_FILE, preprocessorData.join('\n')); 23 | fs.writeFileSync(DOWNLOADER_FILE, downloaderData.join('\n')); 24 | 25 | function escape(str) { 26 | return str.replace(/\//g, '\\/'); 27 | } 28 | 29 | function getFilenameFromUrl(url) { 30 | return url.substring(url.lastIndexOf('/') + 1, url.lastIndexOf('?')); 31 | } 32 | 33 | function addDataToPreprocessor(emoji, filename) { 34 | var src = escape(__dirname + '/emojis/' + filename); 35 | var string = ' s/:' + emoji + 36 | '://g;'; 37 | preprocessorData.push(string); 38 | } 39 | 40 | function addDataToDownloader(url, filename) { 41 | var string = 'curl ' + url + ' > emojis/' + filename; 42 | downloaderData.push(string); 43 | } 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GitHub emojis for Marked 2 2 | 3 | [Marked 2](http://marked2app.com/) is a great markdown previewer and it works 4 | really well with GitHub styles. 5 | It does not display GitHub emojis though. 6 | This repo contains a preprocessor to add support for emojis, so you can write 7 | `:octocat:` in your code and see an emoji in previewer. 8 | 9 | ![](marked-emojis.png) 10 | 11 | ## Install 12 | 13 | 1. Download [zip file](https://github.com/tonyganch/marked-emojis/releases/download/v1.0/marked-emojis.zip). It contains emojis from GitHub and a preprocessor file. 14 | 1. In Marked 2 application open "Preferences" -> "Advanced" -> "Preprocessor". 15 | 1. Check "Enable Custom Preprocessor". 16 | 1. In "Path" field type in path to `preprocessor.sh` file inside downloaded 17 | folder from step 1. 18 | 1. Done. 19 | 20 | ## Build 21 | 22 | You can build and download all files yourself. 23 | 24 | 1. Clone the repo. 25 | 1. Run `build.sh` file. It will download emojis from GitHub and build 26 | a preprocessor file. Please note that downloading may take some time. 27 | 1. In Marked 2 application open "Preferences" -> "Advanced" -> "Preprocessor". 28 | 1. Check "Enable Custom Preprocessor". 29 | 1. In "Path" field type in path to `preprocessor.sh` file inside the repo. 30 | 1. Done. 31 | 32 | ## Issues 33 | 34 | 1. Preprocessor is not smart enough so it will show emojis inside code blocks 35 | too. 36 | 1. Preprocessor uses `sed` command for replacement so it must be present on your 37 | computer. 38 | --------------------------------------------------------------------------------