Skip to content

Commit

Permalink
Merge pull request #875 from adam-p/dev
Browse files Browse the repository at this point in the history
switch default TeX renderer
  • Loading branch information
adam-p authored Nov 10, 2024
2 parents 4805098 + 605f64b commit f623b0d
Show file tree
Hide file tree
Showing 37 changed files with 3,354 additions and 3,118 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ MIT License: https://adampritchard.mit-license.org/ or see [the `LICENSE` file](

### Logo

Copyright 2015, [Austin Anderson](http://protractor.ninja/). Licensed to Markdown Here under the [MDH contributor license agreement](https://github.com/adam-p/markdown-here/blob/master/CLA-individual.md).
Copyright 2015, [Austin Anderson](https://www.angerson.org/). Licensed to Markdown Here under the [MDH contributor license agreement](https://github.com/adam-p/markdown-here/blob/master/CLA-individual.md).

### Other images

Expand Down
520 changes: 267 additions & 253 deletions src/_locales/de/messages.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@
"message": "<strong>Privacy Issues:</strong>",
"description": "heading for warnings about TeX math privacy concerns"
},
"options_page__tex_math_privacy_issue_1": {
"message": "To generate the image for the formula, a request is sent to Google. That effectively means that you are sharing your formula with Google. It also means that recipients of your message will be making a request to Google to have the image rendered.",
"options_page__tex_math_codecogs_privacy_issue_1": {
"message": "To generate the image for the formula, a request is sent to CodeCogs. That effectively means that you are sharing your formula with CodeCogs. It also means that recipients of your message will be making a request to CodeCogs to have the image rendered.",
"description": "one of the TeX math privacy concerns"
},
"options_page__tex_math_privacy_issue_2": {
Expand All @@ -220,11 +220,11 @@
"message": "If this feature is enabled, text between dollar signs — <code>$$</code> — will be interpreted as mathematical formulae. For example, <code>$$\\Delta$$</code> would be rendered as a delta symbol.",
"description": "Note: Double dollar signs ($$) are necessary to get a single dollar sign."
},
"options_page__tex_math_customization_2": {
"message": "For render customization options, see the <a href=\"https://developers.google.com/chart/infographics/docs/formulas\" target=\"_blank\">Google Charts documentation</a> for this service."
"options_page__tex_math_codecogs_customization_2": {
"message": "For render customization options, see the <a href=\"https://editor.codecogs.com/docs/4-LaTeX_rendering.php\" target=\"_blank\">CodeCogs documentation</a> for this service."
},
"options_page__tex_math_customization_3": {
"message": "A good resource for creating TeX formulae is the <a href=\"https://www.codecogs.com/latex/about.php\" target=\"_blank\">CodeCogs Equation Editor</a>."
"message": "A good resource for creating TeX formulae is the <a href=\"https://editor.codecogs.com/\" target=\"_blank\">CodeCogs Equation Editor</a>."
},
"options_page__tex_math_customization_4": {
"message": "Formulae are rendered to images, so email recipients will have to enable images to be shown to see the rendering."
Expand Down
519 changes: 266 additions & 253 deletions src/_locales/es/messages.json

Large diffs are not rendered by default.

519 changes: 266 additions & 253 deletions src/_locales/fr/messages.json

Large diffs are not rendered by default.

519 changes: 266 additions & 253 deletions src/_locales/it/messages.json

Large diffs are not rendered by default.

519 changes: 266 additions & 253 deletions src/_locales/ja/messages.json

Large diffs are not rendered by default.

519 changes: 266 additions & 253 deletions src/_locales/ko/messages.json

Large diffs are not rendered by default.

519 changes: 266 additions & 253 deletions src/_locales/pl/messages.json

Large diffs are not rendered by default.

519 changes: 266 additions & 253 deletions src/_locales/pt_BR/messages.json

Large diffs are not rendered by default.

519 changes: 266 additions & 253 deletions src/_locales/ru/messages.json

Large diffs are not rendered by default.

519 changes: 266 additions & 253 deletions src/_locales/tr/messages.json

Large diffs are not rendered by default.

519 changes: 266 additions & 253 deletions src/_locales/zh_CN/messages.json

Large diffs are not rendered by default.

519 changes: 266 additions & 253 deletions src/_locales/zh_TW/messages.json

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion src/common/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
Change Log
==========

2024-11-09: v2.14.2
-------------------

* Fixed [issue #261](https://github.com/adam-p/markdown-here/issues/261): Switched from using the Google Chart API to CodeCogs for the the TeX renderer. Google shut down the API we were using, so it just didn't work anymore.
- Take a look at [the wiki](https://github.com/adam-p/markdown-here/wiki/Tips-and-Tricks#tex) for information on using other rendering services.
- Some day maybe we'll figure out how to [render locally](https://github.com/adam-p/markdown-here/issues/874).

2024-10-17: v2.14.1
-------------------

* Fixed error on the options page.

2024-10-03: v2.14.0
-------------------

Expand Down Expand Up @@ -46,7 +58,7 @@ Change Log
2015-09-07: v2.12.0
--------------------

* **New logo!** Created by [Austin Anderson](http://protractor.ninja/) and chosen by the Markdown Here users, our great new logo is finally ready for action.
* **New logo!** Created by [Austin Anderson](https://www.angerson.org/) and chosen by the Markdown Here users, our great new logo is finally ready for action.
- Much thanks to Austin for his work polishing and tweaking the 60 variants of the logo. He did a lot of work getting things just right.
- Thanks to everyone else who submitted a design: [Rafe Goldberg](http://rgd2.co/), [Jack Reis](http://www.ux-jack.com/), [Enrique Esquinas](https://twitter.com/esquinas), [Leon Wilmanns](http://leon-wilmanns.de/). All of their designs were great and I would have been happy for any of them to win.
- Seriously, if you haven't seen the other designs, [go check them out](https://markdown-here.com/logo.html). And then check out their portfolios, bookmark them, and contact them the next time you need design work done.
Expand Down
11 changes: 10 additions & 1 deletion src/common/options-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (typeof(Utils) === 'undefined' && typeof(Components) !== 'undefined') {
// Common defaults
var DEFAULTS = {
'math-enabled': true,
'math-value': '<img src="https://chart.googleapis.com/chart?cht=tx&chl={urlmathcode}" alt="{mathcode}">',
'math-value': '<img src="https://latex.codecogs.com/png.image?\\dpi{120}\\inline&space;{urlmathcode}" alt="{mathcode}">',
'hotkey': { shiftKey: false, ctrlKey: true, altKey: true, key: 'M' },
'forgot-to-render-check-enabled': false,
'header-anchors-enabled': false,
Expand Down Expand Up @@ -50,6 +50,7 @@ var DEFAULTS = {

var ChromeOptionsStore = {


// The options object will be passed to `callback`
get: function(callback) {
var that = this;
Expand Down Expand Up @@ -500,6 +501,14 @@ if (!this.OptionsStore) {
this.OptionsStore._fillDefaults = function(prefsObj, callback) {
var that = this;

// Upgrade the object, if necessary.
// Motivation: Our default for the LaTeX renderer used to be Google Charts API. Google
// discontinued the service and we switched the default to CodeCogs, but because it was
// the default, it will be set in many users' OptionsStore. We need to forcibly replace it.
if (typeof prefsObj['math-value'] === 'string' && prefsObj['math-value'].indexOf('chart.googleapis.com') >= 0) {
prefsObj['math-value'] = that.defaults['math-value'];
}

var key, allKeys = [];
for (key in that.defaults) {
if (that.defaults.hasOwnProperty(key)) {
Expand Down
10 changes: 5 additions & 5 deletions src/common/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,8 @@ <h1>
<p>
<span data-i18n="tex_math_privacy_heading"><strong>Privacy Issues:</strong></span>
<ul>
<li data-i18n="tex_math_privacy_issue_1">
To generate the image for the formula, a request is sent to Google. That effectively means that you are sharing your formula with Google. It also means that recipients of your message will be making a request to Google to have the image rendered.
<li data-i18n="tex_math_codecogs_privacy_issue_1">
To generate the image for the formula, a request is sent to CodeCogs. That effectively means that you are sharing your formula with CodeCogs. It also means that recipients of your message will be making a request to CodeCogs to have the image rendered.
</li>
<li data-i18n="tex_math_privacy_issue_2">
If you customize the formula rendering tag, you should use a secure (https://) path. Not all rendering services provide a secure option.
Expand All @@ -520,11 +520,11 @@ <h1>
<li data-i18n="tex_math_customization_1">
If this feature is enabled, text between dollar signs — <code>$</code> — will be interpreted as mathematical formulae. For example, <code>$\Delta$</code> would be rendered as a delta symbol.
</li>
<li data-i18n="tex_math_customization_2">
For render customization options, see the <a href="https://developers.google.com/chart/infographics/docs/formulas" target="_blank">Google Charts documentation</a> for this service.
<li data-i18n="tex_math_codecogs_customization_2">
For render customization options, see the <a href="https://editor.codecogs.com/docs/4-LaTeX_rendering.php" target="_blank">CodeCogs documentation</a> for this service.
</li>
<li data-i18n="tex_math_customization_3">
A good resource for creating TeX formulae is the <a href="https://www.codecogs.com/latex/about.php" target="_blank">CodeCogs Equation Editor</a>.
A good resource for creating TeX formulae is the <a href="https://editor.codecogs.com/" target="_blank">CodeCogs Equation Editor</a>.
</li>
<li data-i18n="tex_math_customization_4">
Formulae are rendered to images, so email recipients will have to enable images to be shown to see the rendering.
Expand Down
34 changes: 17 additions & 17 deletions src/common/test/markdown-render-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('Markdown-Render', function() {
// Test issue #57: https://github.com/adam-p/markdown-here/issues/57
it('should add the schema to links missing it', function() {
var md = 'asdf [aaa](bbb) asdf [ccc](ftp://ddd) asdf';
var target = '<p>asdf <a href="http://bbb">aaa</a> asdf <a href="ftp://ddd">ccc</a> asdf</p>\n';
var target = '<p>asdf <a href="https://bbb">aaa</a> asdf <a href="ftp://ddd">ccc</a> asdf</p>\n';
expect(MarkdownRender.markdownRender(md, userprefs, marked, hljs)).to.equal(target);
});

Expand Down Expand Up @@ -85,17 +85,17 @@ describe('Markdown-Render', function() {
// https://github.com/adam-p/markdown-here/issues/84
it('should render single-character math formulae', function() {
userprefs = {
'math-value': '<img class="mdh-math" src="https://chart.googleapis.com/chart?cht=tx&chl={urlmathcode}" alt="{mathcode}">',
'math-value': '<img class="mdh-math" src="https://latex.codecogs.com/png.image?\\dpi{120}\\inline&space;{urlmathcode}" alt="{mathcode}">',
'math-enabled': true
};

var md = '$x$';
var target = '<p><img class="mdh-math" src="https://chart.googleapis.com/chart?cht=tx&chl=x" alt="x"></p>\n';
var target = '<p><img class="mdh-math" src="https://latex.codecogs.com/png.image?\\dpi{120}\\inline&space;x" alt="x"></p>\n';
expect(MarkdownRender.markdownRender(md, userprefs, marked, hljs)).to.equal(target);

// Make sure we haven't broken multi-character forumlae
md = '$xx$';
target = '<p><img class="mdh-math" src="https://chart.googleapis.com/chart?cht=tx&chl=xx" alt="xx"></p>\n';
target = '<p><img class="mdh-math" src="https://latex.codecogs.com/png.image?\\dpi{120}\\inline&space;xx" alt="xx"></p>\n';
expect(MarkdownRender.markdownRender(md, userprefs, marked, hljs)).to.equal(target);
});

Expand Down Expand Up @@ -241,36 +241,36 @@ describe('Markdown-Render', function() {
'<p>asdf <a href="http://www.aaa.com">bbb</a> asdf</p>\n']);

tests.push(['<a href="aaa">bbb</a>',
'<p><a href="http://aaa">bbb</a></p>\n']);
'<p><a href="https://aaa">bbb</a></p>\n']);

tests.push(['[xxx](yyy) <a href="aaa">bbb</a>',
'<p><a href="http://yyy">xxx</a> <a href="http://aaa">bbb</a></p>\n']);
'<p><a href="https://yyy">xxx</a> <a href="https://aaa">bbb</a></p>\n']);

tests.push(['asdf (<a href="aaa">bbb</a>)',
'<p>asdf (<a href="http://aaa">bbb</a>)</p>\n']);
'<p>asdf (<a href="https://aaa">bbb</a>)</p>\n']);

// Begin tests where the link should *not* be converted.
// Note that some tests are affected by issue #57: MD links should automatically add scheme

tests.push(['asdf [yyy](<a href="http://www.aaa.com">bbb</a>) asdf',
'<p>asdf <a href="http://bbb">yyy</a> asdf</p>\n']);
'<p>asdf <a href="https://bbb">yyy</a> asdf</p>\n']);

tests.push(['asdf [<a href="http://www.aaa.com">bbb</a>](ccc) asdf',
'<p>asdf <a href="http://ccc">bbb</a> asdf</p>\n']);
'<p>asdf <a href="https://ccc">bbb</a> asdf</p>\n']);

tests.push(['[yyy](<a href="http://www.aaa.com">bbb</a>)',
'<p><a href="http://bbb">yyy</a></p>\n']);
'<p><a href="https://bbb">yyy</a></p>\n']);

tests.push(['[yyy]( <a href="http://www.aaa.com">bbb</a>)',
'<p><a href="http://bbb">yyy</a></p>\n']);
'<p><a href="https://bbb">yyy</a></p>\n']);

tests.push(['asdf [qwer <a href="http://www.aaa.com">bbb</a>](ccc) asdf',
'<p>asdf <a href="http://ccc">qwer bbb</a> asdf</p>\n']);
'<p>asdf <a href="https://ccc">qwer bbb</a> asdf</p>\n']);

// Begin mixed tests

tests.push(['asdf [aaa](bbb) asdf <a href="http://www.aaa.com">bbb</a> asdf [yyy](<a href="http://www.aaa.com">bbb</a>) asdf',
'<p>asdf <a href="http://bbb">aaa</a> asdf <a href="http://www.aaa.com">bbb</a> asdf <a href="http://bbb">yyy</a> asdf</p>\n']);
'<p>asdf <a href="https://bbb">aaa</a> asdf <a href="http://www.aaa.com">bbb</a> asdf <a href="https://bbb">yyy</a> asdf</p>\n']);

// Begin tests that don't work quite right

Expand All @@ -288,7 +288,7 @@ describe('Markdown-Render', function() {
// Test issue #57: https://github.com/adam-p/markdown-here/issues/57
it('should add the schema to links missing it', function() {
var md = 'asdf [aaa](bbb) asdf [ccc](ftp://ddd) asdf';
var target = '<p>asdf <a href="http://bbb">aaa</a> asdf <a href="ftp://ddd">ccc</a> asdf</p>\n';
var target = '<p>asdf <a href="https://bbb">aaa</a> asdf <a href="ftp://ddd">ccc</a> asdf</p>\n';
expect(fullRender(md)).to.equal(target);
});

Expand Down Expand Up @@ -320,17 +320,17 @@ describe('Markdown-Render', function() {
// https://github.com/adam-p/markdown-here/issues/84
it('should render single-character math formulae', function() {
userprefs = {
'math-value': '<img class="mdh-math" src="https://chart.googleapis.com/chart?cht=tx&chl={urlmathcode}" alt="{mathcode}">',
'math-value': '<img class="mdh-math" src="https://latex.codecogs.com/png.image?\\dpi{120}\\inline&space;{urlmathcode}" alt="{mathcode}">',
'math-enabled': true
};

var md = '$x$';
var target = '<p><img class="mdh-math" src="https://chart.googleapis.com/chart?cht=tx&chl=x" alt="x"></p>\n';
var target = '<p><img class="mdh-math" src="https://latex.codecogs.com/png.image?\\dpi{120}\\inline&space;x" alt="x"></p>\n';
expect(fullRender(md)).to.equal(target);

// Make sure we haven't broken multi-character forumlae
md = '$xx$';
target = '<p><img class="mdh-math" src="https://chart.googleapis.com/chart?cht=tx&chl=xx" alt="xx"></p>\n';
target = '<p><img class="mdh-math" src="https://latex.codecogs.com/png.image?\\dpi{120}\\inline&space;xx" alt="xx"></p>\n';
expect(fullRender(md)).to.equal(target);
});

Expand Down
Loading

0 comments on commit f623b0d

Please sign in to comment.