Skip to content

Conversation

@Himura2la
Copy link
Contributor

@Himura2la Himura2la commented Oct 20, 2017

I tried to display my equation like this (but a bit more heavy)

https://mathembed.com/latex?inputText=%5Cbegin%7Bpmatrix%7D%0Ay_0%20%26%20z_c%20%26%20x_0%0A%5Cend%7Bpmatrix%7D

and failed.

Here's the fix, please merge and publish to mathembed.com

@codeOfRobin codeOfRobin merged commit 223eb18 into codeOfRobin:master Oct 20, 2017
@codeOfRobin
Copy link
Owner

Huh, I'm not quite so sure how this works 🤔. But I'm not one to argue with regex magic, so go ahead!

@Himura2la
Copy link
Contributor Author

Himura2la commented Oct 20, 2017

I didn't catch it also, but StackExchance, you know... xD
Thanks for merging, I hope this won't break anything.
Now it requires ES6 for multiline strings

@codeOfRobin
Copy link
Owner

It's deployed automatically on the mathembed.com server, in case you want to check. Also, thank you for contributing!

PS: May I know where you're using mathembed? I'd love to place your work as part of an "examples" section in the README!

@Himura2la
Copy link
Contributor Author

Himura2la commented Oct 20, 2017

I used it on Medium. Although looks like I can't control the embed area size there, which is quite sad

image

@codeOfRobin
Copy link
Owner

Ah, that's sadly a limitation of the oembed spec. You have to provide a set height and width. I wonder if you could set it dynamically 🤔 (will have to double check if the spec has changed)

@codeOfRobin
Copy link
Owner

codeOfRobin commented Oct 20, 2017

If it helps, we could reduce the default height to fit most common use cases

@Himura2la Himura2la deleted the patch-1 branch October 20, 2017 09:33
@Himura2la
Copy link
Contributor Author

Himura2la commented Oct 20, 2017

If you control the the size of an embed area, it's better to make it fit the content.
If you really need this, for now the height of my tallest equation is 250px

@Himura2la
Copy link
Contributor Author

About the PR, it was a very quick fix, consifer moving the code here https://github.com/codeOfRobin/MathEmbed/blob/master/app.js#L51

When it's where it is now, the processing and markup are mixed, whis is a bad architecture

@codeOfRobin
Copy link
Owner

codeOfRobin commented Oct 20, 2017

When it's where it is now, the processing and markup are mixed, whis is a bad architecture

Yes, definitely 😄 . I wrote this as a quick hack over a couple of days, will definitely consider cleaning it up.

As for the size considerations, check out section 2.3.4.4 on https://oembed.com . I wonder if there's a way to compute an estimated height from the embed URL?

@Himura2la
Copy link
Contributor Author

Himura2la commented Oct 20, 2017

Example: http://img.catbo.at/oembed.json?url=http://img.catbo.at/3fb93c1b7891aedb18aa41fb325cbc92e82e58a1.jpg&maxwidth=200&maxheight=45&format=json

?

It will solve the problem if we just let the user control the width/height values via the GET parameters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants