Comments (3)
I had a (very) quick stab at this before I had to run out to work this morning, this is the modification to markdown.js
that I came up with:
const mathParser = new MathParser({
operators : {
// These default to true, but are included to be explicit
add : true,
subtract : true,
multiply : true,
divide : true,
power : true,
round : true,
floor : true,
ceil : true,
abs : true,
sin : false, cos : false, tan : false, asin : false, acos : false,
atan : false, sinh : false, cosh : false, tanh : false, asinh : false,
acosh : false, atanh : false, sqrt : false, cbrt : false, log : false,
log2 : false, ln : false, lg : false, log10 : false, expm1 : false,
log1p : false, trunc : false, join : false, sum : false,
'-' : false, '+' : false, exp : false, not : false, length : false,
'!' : false, sign : false, random : false, fac : false, min : false,
max : false, hypot : false, pyt : false, pow : false, atan2 : false,
'if' : false, gamma : false, roundTo : false, map : false, fold : false,
filter : false, indexOf : false,
remainder : false, factorial : false,
comparison : false, concatenate : false,
logical : false, assignment : false,
array : false, fndef : false
}
});
mathParser.functions.sign = function (a) {
if(a == 0) return null;
if(a > 0) {
return '+';
} else {
return '\\-';
}
};
I was not having any luck getting abs()
to actually function in a brew, even after enabling it.
On further thought, I believe we could also (or instead) include a signed
function that returns the input value as a string with a +/- prefix:
mathParser.functions.signed = function (a) {
if(a >= 0) {
return `+${a}`;
} else {
return `\\${a}`;
}
};
(NB: the negative prefix needs to be \\-
or else it will be treated as the start of a list when used at the beginning of a line; I have not yet determined any scenarios that require the positive prefix to be handled similarly)
from homebrewery.
Looks like the variable hasn't been resolved to the value at the time that the function runs:
from homebrewery.
signed
works pretty well in it's current iteration:
from homebrewery.
Related Issues (20)
- The StringArrayEditor component returns error if you `ESC` out of it HOT 3
- A more legible dice font HOT 5
- Brew Theme Extensions HOT 5
- Support for "string" refs will be deprecated HOT 3
- Error saving HOT 1
- Window/Tab freezes on input of H1 header off the "page" (third column or later) - Firefox MacOS HOT 2
- ReactDOM.hydrate() is deprecated, console error HOT 6
- No dead-code elimination console error on live site
- Migrate from Vitreum to Webpack AND/OR other services HOT 4
- New Page: Database statistics HOT 1
- Using Monospace Fonts with any Editor Theme HOT 1
- Provide a Linkable URL to ID Heading HOT 2
- Bump CodeMirror to 6 HOT 1
- Block cloning HOT 5
- Issue while autosaviong the document HOT 1
- Not saving HOT 1
- Saving Error HOT 2
- Selector suggestion in Style editor tab
- Add pageflip effect to share page /new share page
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homebrewery.