From ada6c926dc026aaec1804e93c19d42f497dfeefc Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 10 Feb 2017 01:19:27 +0900 Subject: [PATCH] Add NaN support --- src/common/text/elements/code.js | 14 ++++++++++++++ src/web/app/base.styl | 1 + 2 files changed, 15 insertions(+) diff --git a/src/common/text/elements/code.js b/src/common/text/elements/code.js index 5056bd137..df81b715c 100644 --- a/src/common/text/elements/code.js +++ b/src/common/text/elements/code.js @@ -271,6 +271,20 @@ const elements = [ } }, + // nan + (code, i, source) => { + const prev = source[i - 1]; + if (prev && /[a-zA-Z]/.test(prev)) return null; + if (code.substr(0, 3) == 'NaN') { + return { + html: `NaN`, + next: 3 + }; + } else { + return null; + } + }, + // keyword (code, i, source) => { const prev = source[i - 1]; diff --git a/src/web/app/base.styl b/src/web/app/base.styl index e753a78d5..0e5eeba97 100644 --- a/src/web/app/base.styl +++ b/src/web/app/base.styl @@ -137,6 +137,7 @@ pre color #42b983 .number + .nan color #ae81ff .var:not(.keyword)