KaTeX / KaTeX

Fast math typesetting for the web.

Home Page:https://katex.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Copy Tex is broken

Mister-Hope opened this issue · comments

I don't think this file is a valid javascript file, the file is packed and published to NPM AS-IS, while it's containing type declaration:

function closestKatex(node: Node): ?Element {
    // If node is a Text Node, for example, go up to containing Element,
    // where we can apply the `closest` method.
    const element: ?Element =
document.addEventListener('copy', function(event: ClipboardEvent) {

This breaks the copy feature.

Hi, I would like to work on this issue

Sorry for taking so long to look at this issue. You're right that katex/contrib/copy-tex contains the original source file. Related, src contains all source code. These aren't particularly helpful, but I think it's not terrible to have them — especially once we switch to TypeScript and have .ts extensions.

Fortunately, katex/dist/contrib contains the correctly built versions of copy-tex.js. The <script> tags in the documentation also provide this path, though perhaps they should also include an NPM-based example. Could you think about what documentation would have helped with your issue?