Browse Source

feat: twemoji + headers fix

pull/760/head
Nicolas Giard 5 years ago
parent
commit
1771289188
8 changed files with 65 additions and 44 deletions
  1. 39
      client/themes/default/scss/app.scss
  2. 22
      dev/build/Dockerfile
  3. 23
      dev/build/supervisord.conf
  4. 1
      package.json
  5. 2
      server/modules/rendering/html-core/renderer.js
  6. 8
      server/modules/rendering/html-twemoji/definition.yml
  7. 9
      server/modules/rendering/html-twemoji/renderer.js
  8. 5
      server/modules/rendering/markdown-emoji/renderer.js

39
client/themes/default/scss/app.scss

@ -69,6 +69,7 @@
padding: 8px 0 0 0; padding: 8px 0 0 0;
color: mc('grey', '800'); color: mc('grey', '800');
position: relative; position: relative;
margin-top: 1rem;
@at-root .theme--dark & { @at-root .theme--dark & {
color: mc('grey', '500'); color: mc('grey', '500');
@ -134,6 +135,11 @@
} }
} }
.emoji {
height: 1.25em;
margin: 0 1px -4px;
}
blockquote { blockquote {
padding: 0 0 1rem 0; padding: 0 0 1rem 0;
border: 1px solid mc('blue', '500'); border: 1px solid mc('blue', '500');
@ -214,6 +220,30 @@
} }
} }
// ---------------------------------
// LISTS
// ---------------------------------
ol, ul {
padding: 1rem 24px 0 24px;
list-style-position: inside;
li + li {
margin-top: .5rem;
}
}
ul {
list-style: none;
> li::before {
content: '\25b8';
color: mc('grey', '600');
display: inline-block;
width: 1.35rem;
}
}
// --------------------------------- // ---------------------------------
// CODE // CODE
// --------------------------------- // ---------------------------------
@ -232,15 +262,6 @@
} }
} }
ol, ul {
padding: 1rem 24px 0 24px;
list-style-position: inside;
li + li {
margin-top: .5rem;
}
}
.prismjs{ .prismjs{
border: none; border: none;
border-radius: 5px; border-radius: 5px;

22
dev/build/Dockerfile

@ -1,14 +1,14 @@
# ==================== # ====================
# --- Build Assets --- # --- Build Assets ---
# ==================== # ====================
FROM node:10.14-alpine AS assets
FROM node:10.15-alpine AS assets
RUN apk update && \ RUN apk update && \
apk add yarn g++ make python --no-cache && \ apk add yarn g++ make python --no-cache && \
rm -rf /var/cache/apk/* && \ rm -rf /var/cache/apk/* && \
mkdir -p /var/wiki
mkdir -p /wiki
WORKDIR /var/wiki
WORKDIR /wiki
COPY ./client ./client COPY ./client ./client
COPY ./dev ./dev COPY ./dev ./dev
@ -19,28 +19,28 @@ COPY ./.eslintrc.yml ./.eslintrc.yml
RUN yarn --cache-folder /codefresh/volume/yarn RUN yarn --cache-folder /codefresh/volume/yarn
RUN yarn build RUN yarn build
RUN rm -rf /var/wiki/node_modules
RUN rm -rf /wiki/node_modules
RUN yarn --production RUN yarn --production
# =============== # ===============
# --- Release --- # --- Release ---
# =============== # ===============
FROM node:10.14-alpine
FROM node:10.15-alpine
LABEL maintainer="requarks.io" LABEL maintainer="requarks.io"
RUN apk update && \ RUN apk update && \
apk add bash curl git openssh supervisor --no-cache && \ apk add bash curl git openssh supervisor --no-cache && \
rm -rf /var/cache/apk/* && \ rm -rf /var/cache/apk/* && \
mkdir -p /var/wiki && \
mkdir -p /wiki && \
mkdir -p /logs mkdir -p /logs
WORKDIR /var/wiki
WORKDIR /wiki
COPY ./dev/build/supervisord.conf /etc/supervisord.conf COPY ./dev/build/supervisord.conf /etc/supervisord.conf
COPY --from=assets /var/wiki/assets ./assets
COPY --from=assets /var/wiki/node_modules ./node_modules
COPY --from=assets /wiki/assets ./assets
COPY --from=assets /wiki/node_modules ./node_modules
COPY ./server ./server COPY ./server ./server
COPY --from=assets /var/wiki/server/views ./server/views
COPY --from=assets /wiki/server/views ./server/views
COPY ./dev/build/config.yml ./config.yml COPY ./dev/build/config.yml ./config.yml
COPY ./dev/docker/wait.sh ./wait.sh COPY ./dev/docker/wait.sh ./wait.sh
COPY ./package.json ./package.json COPY ./package.json ./package.json
@ -48,4 +48,4 @@ COPY ./LICENSE ./LICENSE
EXPOSE 3000 EXPOSE 3000
CMD ["supervisord", "--nodaemon", "-c", "/etc/supervisord.conf"]
CMD ["node", "server"]

23
dev/build/supervisord.conf

@ -1,23 +0,0 @@
[unix_http_server]
file=/var/run/supervisor.sock
chmod=0700
[supervisord]
logfile=/logs/supervisord.log
pidfile=/var/run/supervisord.pid
childlogdir=/logs
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock
[program:wikijs]
command = node server
autostart=true
autorestart=true
priority=5
directory=/var/wiki
stdout_logfile=/logs/wiki-stdout.log
stderr_logfile=/logs/wiki-stderr.log

1
package.json

@ -155,6 +155,7 @@
"serve-favicon": "2.5.0", "serve-favicon": "2.5.0",
"sqlite3": "4.0.4", "sqlite3": "4.0.4",
"subscriptions-transport-ws": "0.9.15", "subscriptions-transport-ws": "0.9.15",
"twemoji": "11.2.0",
"uslug": "1.0.4", "uslug": "1.0.4",
"uuid": "3.3.2", "uuid": "3.3.2",
"validate.js": "0.12.0", "validate.js": "0.12.0",

2
server/modules/rendering/html-core/renderer.js

@ -14,6 +14,6 @@ module.exports = {
renderer.init($, child.config) renderer.init($, child.config)
} }
return $.html()
return $.html('body').replace('<body>', '').replace('</body>', '')
} }
} }

8
server/modules/rendering/html-twemoji/definition.yml

@ -0,0 +1,8 @@
key: htmlTwemoji
title: Twemoji
description: Apply Twitter Emojis to all Unicode emojis
author: requarks.io
icon: whatshot
enabledDefault: true
dependsOn: htmlCore
props: {}

9
server/modules/rendering/html-twemoji/renderer.js

@ -0,0 +1,9 @@
// ------------------------------------
// HTML - Twemoji
// ------------------------------------
module.exports = {
init ($, conf) {
}
}

5
server/modules/rendering/markdown-emoji/renderer.js

@ -1,4 +1,5 @@
const mdEmoji = require('markdown-it-emoji') const mdEmoji = require('markdown-it-emoji')
const twemoji = require('twemoji')
// ------------------------------------ // ------------------------------------
// Markdown - Emoji // Markdown - Emoji
@ -7,5 +8,9 @@ const mdEmoji = require('markdown-it-emoji')
module.exports = { module.exports = {
init (md, conf) { init (md, conf) {
md.use(mdEmoji) md.use(mdEmoji)
md.renderer.rules.emoji = (token, idx) => {
return twemoji.parse(token[idx].content)
}
} }
} }
Loading…
Cancel
Save