Commit graph

182 commits

Author SHA1 Message Date
Jakub Jirutka
3a46203257 Add jest-chain 2019-09-29 02:02:14 +02:00
Jakub Jirutka
1c91dcf9f3 Load test/setup.ts implicitly 2019-09-29 02:02:14 +02:00
Jakub Jirutka
35ba8cc87f Handle empty cell.source in CodeCell() instead of Source() 2019-09-29 02:02:06 +02:00
Jakub Jirutka
f5e5006e04 Don't return undefined in executionCountAttrs() 2019-09-28 16:04:51 +02:00
Jakub Jirutka
21044fe8a2 Remove fallback to notebook.metadata.kernelspec.language
nbformat 4.x defines only `notebook.metadata.language_info.name` for the
notebook language. `notebook.metadata.kernelspec.language` is
non-standard, probably from some older nbformat version. It just
increases complexity for testing, so get rid of it.
2019-09-28 15:19:54 +02:00
Jakub Jirutka
7718f4b606 Change buildRenderer() to accept elementCreator as first argument 2019-09-28 15:19:53 +02:00
Jakub Jirutka
196b37827f Disable ESLint rule consistent-type-definitions
It's actually better to use "interface" instead of "type" - interfaces
preserve their name in error messages, types do not (they are just
aliases).
2019-09-28 01:05:25 +02:00
Jakub Jirutka
85875d7663 Fix code-style in readNotebookTitle.test 2019-09-27 14:53:54 +02:00
Jakub Jirutka
17390b1e9d Bump nodom to ^2.3.0
This version fixes the issue with duplicating element attributes.
2019-09-27 12:28:22 +02:00
Jakub Jirutka
ecce6b8485 Move module utils to directory internal 2019-09-26 18:17:51 +02:00
Jakub Jirutka
8771eff957 Fix attribute classes on Source's code element, should be class 2019-09-25 20:33:27 +02:00
Jakub Jirutka
a981901940 Fix argument type of embeddedImageEl() 2019-09-25 16:10:39 +02:00
Jakub Jirutka
9c19c9f340 Add type MultilineString to nbformat 2019-09-25 16:08:33 +02:00
Jakub Jirutka
7963bc442b Handle unsupported Cell and Output types 2019-09-25 16:02:21 +02:00
Jakub Jirutka
3d2e312e4b Add type MimeBundle to nbformat 2019-09-25 14:35:54 +02:00
Jakub Jirutka
0a4f4a09a3 Fix mathExtractor to recognize inline code with line breaks 2019-09-24 01:36:54 +02:00
Jakub Jirutka
53dfd524e0 Use non-capturing groups inside regexps in mathExtractor 2019-09-24 01:16:11 +02:00
Jakub Jirutka
05d38601c1 Add tests for mathExtractor 2019-09-24 00:34:45 +02:00
Jakub Jirutka
5193f92ed2 Trim leading/trailing whitespaces in MathExpression.value 2019-09-23 17:40:36 +02:00
Jakub Jirutka
9c18c74085 Release version v0.1.0-beta.3 2019-09-22 23:29:10 +02:00
Jakub Jirutka
36131b9ed2 Add workaround for SageMath latex outputs 2019-09-22 23:26:58 +02:00
Jakub Jirutka
20f4dec62c Release version 0.1.0-beta.2 2019-09-20 18:17:28 +02:00
Jakub Jirutka
745346150e Add module readNotebookTitle 2019-09-20 18:15:25 +02:00
Jakub Jirutka
526a7b51ea Fix wrong type of Notebook.nbformat 2019-09-18 13:18:00 +02:00
Jakub Jirutka
1d4dd89b21 Release version 0.1.0-beta.1 2019-09-18 00:00:05 +02:00
Jakub Jirutka
cee6f20158 Replace ansi_up with anser
It's smaller...
2019-09-17 23:54:58 +02:00
Jakub Jirutka
a944bf2d27 Pre-configure renderer with all external components 2019-09-17 23:54:58 +02:00
Jakub Jirutka
030b4297ba Add markdownRenderer with marked, katex and highlight.js 2019-09-17 23:54:58 +02:00
Jakub Jirutka
457e1716d9 mathExtractor: Escape marker-like sequences instead of returning them 2019-09-17 23:54:57 +02:00
Jakub Jirutka
34cf2c4620 Replace if-else-if statements with switch statement
I think that it's a bit more readable. But still, why TypeScript still
doesn't have pattern matching, only this crappy C-like switch? :(
2019-09-17 22:06:03 +02:00
Jakub Jirutka
86754fbd98 Reformat comments on renderer.Options 2019-09-17 22:06:03 +02:00
Jakub Jirutka
ca9bae9483 Don't escape math that will be passed to math renderer
KaTeX doesn't interpret escaped <>& correctly and it escapes unsafe
characters in the output implicitly.
2019-09-17 22:06:02 +02:00
Jakub Jirutka
18a7a512cc Don't escape text passed to codeHighlighter
highlight.js does it implicitly.
2019-09-16 23:08:32 +02:00
Jakub Jirutka
e8ed255646 Don't escape text passed to ansiCodeRenderer
The current version of ansi_up does it implicitly.
2019-09-16 23:02:40 +02:00
Jakub Jirutka
431fb1331d CI: Add API Key for npm 2019-09-16 22:54:52 +02:00
Jakub Jirutka
016fae6eb8 mathExtractor: Parse extracted delimited expressions 2019-09-16 22:54:52 +02:00
Jakub Jirutka
cd11e47f54 mathExtractor: Improve docs and function names 2019-09-16 22:54:52 +02:00
Jakub Jirutka
327856497c mathExtractor: Don't modify delimiters in replaceMath() 2019-09-16 22:54:52 +02:00
Jakub Jirutka
4e15e76573 mathExtractor: Modernize and refactor 2019-09-16 22:54:52 +02:00
Jakub Jirutka
443603dd4f mathExtractor: Convert to TypeScript 2019-09-16 22:54:52 +02:00
Jakub Jirutka
464a0b24de mathExtractor: Remove unnecessary escapes in regexps 2019-09-16 22:54:52 +02:00
Jakub Jirutka
aa3b063413 mathExtractor: Change under_score names to camelCase 2019-09-16 22:54:52 +02:00
Jakub Jirutka
92e00f7df8 mathExtractor: Fix code-style
- semicolons
- indentation and alignment
- quotes
2019-09-16 22:54:52 +02:00
Jakub Jirutka
fceb1f8e23 Import math extractor utils from jupyter/notebook repository
Source copied from https://github.com/jupyter/notebook/blob/6.0.1/notebook/static/notebook/js/mathjaxutils.js
with the following modifications:

- indentation converted to 2 spaces
- init function removed
- MSE fix removed
2019-09-16 22:54:52 +02:00
Jakub Jirutka
9ee9575eae Remove mathRenderer option
The current approach doesn't work with nodom because KaTeX's
renderMathInElement() works on an element with full DOM and we have
only element with innerHTML string.
2019-09-16 22:54:52 +02:00
Jakub Jirutka
61c3b5feab Fix escapeHTML() to escape even "&" and refactor it 2019-09-16 22:54:52 +02:00
Jakub Jirutka
f19a70416e Completely refactor renderer and add tests for utils 2019-09-16 22:54:51 +02:00
Jakub Jirutka
9775f6f3bd Rename index.ts to renderer.ts 2019-09-16 22:53:06 +02:00
Jakub Jirutka
eb55e17525 Rename makeElement() to el() 2019-09-16 22:52:40 +02:00
Jakub Jirutka
34195169a6 Sort display renderers by priority and refactor text/svg+xml alias 2019-09-16 22:52:40 +02:00