Giter VIP home page Giter VIP logo

neuromatchacademy / mastodon Goto Github PK

View Code? Open in Web Editor NEW

This project forked from glitch-soc/mastodon

4.0 4.0 2.0 247.13 MB

A glitchy but lovable microblogging server

Home Page: https://glitch-soc.github.io/docs/

License: GNU Affero General Public License v3.0

Shell 0.03% JavaScript 38.82% Ruby 46.04% CSS 0.01% HTML 0.13% Dockerfile 0.05% Haml 3.62% SCSS 9.18% Procfile 0.01% TypeScript 2.13%

mastodon's People

Contributors

abcang avatar akihikodaki avatar beatrix-bitrot avatar c960657 avatar chriswmartin avatar clearlyclaire avatar danielmbrasil avatar dependabot-preview[bot] avatar dependabot[bot] avatar ekiru avatar gargron avatar hannahwhy avatar lynlynlynx avatar marrus-sh avatar mayaeh avatar mightypork avatar mjankowski avatar noellabo avatar nolanlawson avatar nschonni avatar renchap avatar renovate[bot] avatar shleeable avatar sorin-davidoi avatar takayamaki avatar tribela avatar unarist avatar yiskah avatar ykzts avatar ysksn avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

mastodon's Issues

MathJaX renders anything between `$$`

Steps to reproduce the problem

See: https://neuromatch.social/@[email protected]/111502628902459771

Screen Shot 2023-11-30 at 8 40 06 PM

Expected behaviour

Only typeset between \( and \)

Actual behaviour

See above (this issue template sucks)

Detailed description

The instance should be configured like this:

  var nonce = document.querySelector('meta[name="style-nonce"]').getAttribute('content');
  window.MathJax = {
    chtml: {nonce: nonce},
    tex: {
      processEnvironments: false,
      processRefs: false,
      inlineMath: [['\\(', '\\)']],
      displayMath: [['\\[', '\\]']]
      }
    };

:javascript
var nonce = document.querySelector('meta[name="style-nonce"]').getAttribute('content');
window.MathJax = {
chtml: {nonce: nonce},
tex: {
processEnvironments: false,
processRefs: false,
inlineMath: [['\\(', '\\)']],
displayMath: [['\\[', '\\]']]
}
};
%script{ src: '/MathJax/es5/tex-chtml.js' }

which overrides the displayMath delimiters which are $$ by default: https://docs.mathjax.org/en/latest/options/input/tex.html

This is apparently ignored because of the site's content security settings which disallow inline scripts.

So we need to use the nonce that comes from here

%meta{ name: 'style-nonce', content: request.content_security_policy_nonce }

in the script tag, and also allow nonce'd inline scripts in our CSP.

See:

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src#unsafe_inline_script

and

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/Sources#sources

Mastodon instance

neuromatch.social

Mastodon version

garegarg sthsrtjytj

Browser name and version

Firefox

Operating system

macOS

Technical details

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.