From fcb2f10732db61d216e2105c8154486f66b3e3ff Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 29 Apr 2024 06:29:52 +0200 Subject: Adding upstream version 0.3.3. Signed-off-by: Daniel Baumann --- tests/fixtures/admon.md | 269 +++++++++++++++++++ tests/fixtures/amsmath.md | 223 +++++++++++++++ tests/fixtures/anchors.md | 65 +++++ tests/fixtures/attrs.md | 169 ++++++++++++ tests/fixtures/colon_fence.md | 423 +++++++++++++++++++++++++++++ tests/fixtures/container.md | 286 ++++++++++++++++++++ tests/fixtures/deflist.md | 247 +++++++++++++++++ tests/fixtures/dollar_math.md | 552 ++++++++++++++++++++++++++++++++++++++ tests/fixtures/field_list.md | 252 +++++++++++++++++ tests/fixtures/footnote.md | 346 ++++++++++++++++++++++++ tests/fixtures/front_matter.md | 87 ++++++ tests/fixtures/myst_block.md | 149 ++++++++++ tests/fixtures/myst_role.md | 104 +++++++ tests/fixtures/span.md | 0 tests/fixtures/substitution.md | 125 +++++++++ tests/fixtures/tasklists.md | 131 +++++++++ tests/fixtures/texmath_bracket.md | 387 ++++++++++++++++++++++++++ tests/fixtures/texmath_dollar.md | 438 ++++++++++++++++++++++++++++++ tests/fixtures/wordcount.md | 51 ++++ 19 files changed, 4304 insertions(+) create mode 100644 tests/fixtures/admon.md create mode 100644 tests/fixtures/amsmath.md create mode 100644 tests/fixtures/anchors.md create mode 100644 tests/fixtures/attrs.md create mode 100644 tests/fixtures/colon_fence.md create mode 100644 tests/fixtures/container.md create mode 100644 tests/fixtures/deflist.md create mode 100644 tests/fixtures/dollar_math.md create mode 100644 tests/fixtures/field_list.md create mode 100644 tests/fixtures/footnote.md create mode 100644 tests/fixtures/front_matter.md create mode 100644 tests/fixtures/myst_block.md create mode 100644 tests/fixtures/myst_role.md create mode 100644 tests/fixtures/span.md create mode 100644 tests/fixtures/substitution.md create mode 100644 tests/fixtures/tasklists.md create mode 100644 tests/fixtures/texmath_bracket.md create mode 100644 tests/fixtures/texmath_dollar.md create mode 100644 tests/fixtures/wordcount.md (limited to 'tests/fixtures') diff --git a/tests/fixtures/admon.md b/tests/fixtures/admon.md new file mode 100644 index 0000000..587ae80 --- /dev/null +++ b/tests/fixtures/admon.md @@ -0,0 +1,269 @@ + +Simple admonition +. +!!! note + *content* +. +
+

Note

+

content

+
+. + + +Could contain block elements too +. +!!! note + ### heading + + ----------- + +. +
+

Note

+

heading

+
+
+. + + +Shows custom title +. +!!! note Custom title + + Some text + +. +
+

Custom title

+

Some text

+
+. + + +Shows no title +. +!!! note "" + Some text + +. +
+

Some text

+
+. + + +Closes block after 2 empty lines +. +!!! note + Some text + + + A code block +. +
+

Note

+

Some text

+
+
A code block
+
+. + + +Nested blocks +. +!!! note + !!! note + Some text + + code block +. +
+

Note

+
+

Note

+

Some text

+
code block
+
+
+
+. + + +Consecutive admonitions +. +!!! note + +!!! warning +. +
+

Note

+
+
+

Warning

+
+. + + +Marker may be indented up to 3 chars +. + !!! note + content +. +
+

Note

+

content

+
+. + + +But that's a code block +. + !!! note + content +. +
!!! note
+    content
+
+. + + +Some more indent checks +. + !!! note + not a code block + + code block +. +
+

Note

+
+

not a code block

+
code block
+
+. + + +Type could be adjacent to marker +. +!!!note + xxx + +. +
+

Note

+

xxx

+
+. + + +Type could be adjacent to marker and content may be shifted up to 3 chars +. +!!!note + xxx + +. +
+

Note

+

xxx

+
+. + + +Or several spaces apart +. +!!! note + xxx +. +
+

Note

+

xxx

+
+. + + +Admonitions self-close at the end of the document +. +!!! note + xxx +. +
+

Note

+

xxx

+
+. + + +They could be nested in lists +. +- !!! note + - a + - b +- !!! warning + - c + - d +. + +. + + +Or in blockquotes +. +> !!! note +> xxx +> > yyy +> zzz +> +. +
+
+

Note

+

xxx

+
+

yyy +zzz

+
+
+
+. + + +Renders unknown admonition type +. +!!! unknown title + content +. +
+

title

+

content

+
+. + + +Does not render +. +!!! + content +. +

!!! +content

+. diff --git a/tests/fixtures/amsmath.md b/tests/fixtures/amsmath.md new file mode 100644 index 0000000..ba21544 --- /dev/null +++ b/tests/fixtures/amsmath.md @@ -0,0 +1,223 @@ +equation environment: +. +\begin{equation} +a = 1 +\end{equation} +. +
+\begin{equation} +a = 1 +\end{equation} +
+. + +equation* environment: +. +\begin{equation*} +a = 1 +\end{equation*} +. +
+\begin{equation*} +a = 1 +\end{equation*} +
+. + +multline environment: +. +\begin{multline} +a = 1 +\end{multline} +. +
+\begin{multline} +a = 1 +\end{multline} +
+. + +multline* environment: +. +\begin{multline*} +a = 1 +\end{multline*} +. +
+\begin{multline*} +a = 1 +\end{multline*} +
+. + +gather environment: +. +\begin{gather} +a = 1 +\end{gather} +. +
+\begin{gather} +a = 1 +\end{gather} +
+. + +gather* environment: +. +\begin{gather*} +a = 1 +\end{gather*} +. +
+\begin{gather*} +a = 1 +\end{gather*} +
+. + +align environment: +. +\begin{align} +a = 1 +\end{align} +. +
+\begin{align} +a = 1 +\end{align} +
+. + +align* environment: +. +\begin{align*} +a = 1 +\end{align*} +. +
+\begin{align*} +a = 1 +\end{align*} +
+. + +alignat environment: +. +\begin{alignat} +a = 1 +\end{alignat} +. +
+\begin{alignat} +a = 1 +\end{alignat} +
+. + +alignat* environment: +. +\begin{alignat*} +a = 1 +\end{alignat*} +. +
+\begin{alignat*} +a = 1 +\end{alignat*} +
+. + +flalign environment: +. +\begin{flalign} +a = 1 +\end{flalign} +. +
+\begin{flalign} +a = 1 +\end{flalign} +
+. + +flalign* environment: +. +\begin{flalign*} +a = 1 +\end{flalign*} +. +
+\begin{flalign*} +a = 1 +\end{flalign*} +
+. + +equation environment, with before/after paragraphs: +. +before +\begin{equation} +a = 1 +\end{equation} +after +. +

before

+
+\begin{equation} +a = 1 +\end{equation} +
+

after

+. + +equation environment, in list: +. +- \begin{equation} + a = 1 + \end{equation} +. + +. + +`alignat` environment and HTML escaping +. +\begin{alignat}{3} + & d = \frac{1}{1 + 0.2316419x} \quad && a_1 = 0.31938153 \quad && a_2 = -0.356563782 \\ + & a_3 = 1.781477937 \quad && a_4 = -1.821255978 \quad && a_5 = 1.330274429 +\end{alignat} +. +
+\begin{alignat}{3} + & d = \frac{1}{1 + 0.2316419x} \quad && a_1 = 0.31938153 \quad && a_2 = -0.356563782 \\ + & a_3 = 1.781477937 \quad && a_4 = -1.821255978 \quad && a_5 = 1.330274429 +\end{alignat} +
+. + +`alignat*` environment and HTML escaping +. +\begin{alignat*}{3} +& m \quad && \text{módulo} \quad && m>0\\ +& a \quad && \text{multiplicador} \quad && 0 +\begin{alignat*}{3} +& m \quad && \text{módulo} \quad && m>0\\ +& a \quad && \text{multiplicador} \quad && 0<a<m\\ +& c \quad && \text{constante aditiva} \quad && 0\leq c<m\\ +& x_0 \quad && \text{valor inicial} \quad && 0\leq x_0 <m +\end{alignat*} + +. \ No newline at end of file diff --git a/tests/fixtures/anchors.md b/tests/fixtures/anchors.md new file mode 100644 index 0000000..bd96d1f --- /dev/null +++ b/tests/fixtures/anchors.md @@ -0,0 +1,65 @@ +basic (max level 2): +. +# H1 + +## H2 + +### H3 +. +

H1

+

H2

+

H3

+. + +space: +. +# a b c +. +

a b c

+. + +characters: +. +# a,b\cβÊ +. +

a,b\cβÊ

+. + +emoji: +. +# 🚀a +. +

🚀a

+. + +html entity: +. +# foo&bar +. +

foo&bar

+. + +uniqueness: +. +# a +# a +## a +. +

a

+

a

+

a

+. + +standard (permalink after): +. +# a +. +

a

+. + +standard (permalink before): +. +# a +. +

a

+. diff --git a/tests/fixtures/attrs.md b/tests/fixtures/attrs.md new file mode 100644 index 0000000..75b86aa --- /dev/null +++ b/tests/fixtures/attrs.md @@ -0,0 +1,169 @@ +simple reference link +. +[text *emphasis*](a){#id .a} +. +

text emphasis

+. + +simple definition link +. +[a][]{#id .b} + +[a]: /url +. +

a

+. + +simple image +. +![a](b){#id .a b=c} +. +

a

+. + +simple inline code +. +`a`{#id .a b=c} +. +

a

+. + +ignore if space +. +![a](b) {#id key="*"} +. +

a {#id key="*"}

+. + +ignore if text +. +![a](b)b{#id key="*"} +. +

ab{#id key="*"}

+. + +multi-line +. +![a](b){ + #id .a + b=c + } +more +. +

a +more

+. + +merging attributes +. +![a](b){#a .a}{.b class=x other=h}{#x class="x g" other=a} +. +

a

+. + +spans: simple +. +[a]{#id .b}c +. +

ac

+. + +spans: end of inline before attrs +. +[a] +. +

[a]

+. + +spans: space between brace and attrs +. +[a] {.b} +. +

[a] {.b}

+. + +spans: escaped span start +. +\[a]{.b} +. +

[a]{.b}

+. + +spans: escaped span end +. +[a\]{.b} +. +

[a]{.b}

+. + +spans: escaped span attribute +. +[a]\{.b} +. +

[a]{.b}

+. + +spans: nested text syntax +. +[*a*]{.b}c +. +

ac

+. + +spans: nested span +. +*[a]{.b}c* +. +

ac

+. + +spans: multi-line +. +x [a +b]{#id +b=c} y +. +

x a +b y

+. + +spans: nested spans +. +[[a]{.b}]{.c} +. +

a

+. + +spans: short link takes precedence over span +. +[a]{#id .b} + +[a]: /url +. +

a

+. + +spans: long link takes precedence over span +. +[a][a]{#id .b} + +[a]: /url +. +

a

+. + +spans: link inside span +. +[[a]]{#id .b} + +[a]: /url +. +

a

+. + +spans: merge attributes +. +[a]{#a .a}{#b .a .b other=c}{other=d} +. +

a

+. diff --git a/tests/fixtures/colon_fence.md b/tests/fixtures/colon_fence.md new file mode 100644 index 0000000..b04e0e2 --- /dev/null +++ b/tests/fixtures/colon_fence.md @@ -0,0 +1,423 @@ +# The initial tests are adapted from the test for normal code fences in tests/test_port/fixtures/commonmark_spec.md + +src line: 1638 + +. +::: +< + > +::: +. +
<
+ >
+
+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 1665 + +. +:: +foo +:: +. +

:: +foo +::

+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 1676 + +. +::: +aaa +~~~ +::: +. +
aaa
+~~~
+
+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 1688 + +. +::: +aaa +``` +::: +. +
aaa
+```
+
+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 1702 + +. +:::: +aaa +::: +:::::: +. +
aaa
+:::
+
+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 1729 + +. +::: +. +
+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 1736 + +. +::::: + +::: +aaa +. +

+:::
+aaa
+
+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 1749 + +. +> ::: +> aaa + +bbb +. +
+
aaa
+
+
+

bbb

+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 1765 + +. +::: + + +::: +. +

+  
+
+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 1779 + +. +::: +::: +. +
+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 1791 + +. + ::: + aaa +aaa +::: +. +
aaa
+aaa
+
+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 1803 + +. + ::: +aaa + aaa +aaa + ::: +. +
aaa
+aaa
+aaa
+
+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 1817 + +. + ::: + aaa + aaa + aaa + ::: +. +
aaa
+ aaa
+aaa
+
+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 1833 + +. + ::: + aaa + ::: +. +
:::
+aaa
+:::
+
+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 1848 + +. +::: +aaa + ::: +. +
aaa
+
+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 1858 + +. + ::: +aaa + ::: +. +
aaa
+
+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 1870 + +. +::: +aaa + ::: +. +
aaa
+    :::
+
+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 1884 + +. +::: ::: +aaa +. +
aaa
+
+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 1907 + +. +foo +::: +bar +::: +baz +. +

foo

+
bar
+
+

baz

+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 1946 + +. +:::ruby +def foo(x) + return 3 +end +::: +. +
def foo(x)
+  return 3
+end
+
+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 1974 + +. +::::; +:::: +. +
+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 1984 + +. +::: aa ::: +foo +. +
foo
+
+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 2007 + +. +::: +::: aaa +::: +. +
::: aaa
+
+. + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 2007 + +. +::: +::: aaa +::: +. +
::: aaa
+
+. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Ending marker could be longer +. +::::: name ::::: + hello world +:::::::::::::::: +. +
  hello world
+
+. + +Nested blocks +. +::::: name +:::: name +xxx +:::: +::::: +. +
:::: name
+xxx
+::::
+
+. + +Name could be adjacent to marker +. +:::name +xxx +::: +. +
xxx
+
+. + +They should terminate paragraphs +. +blah blah +::: name +content +::: +. +

blah blah

+
content
+
+. + +They could be nested in lists +. + - ::: name + - xxx + ::: +. +
    +
  • +
    - xxx
    +
    +
  • +
+. + +Or in blockquotes +. +> ::: name +> xxx +>> yyy +> zzz +> ::: +. +
+
xxx
+> yyy
+zzz
+
+
+. + +List indentation quirks +. + - ::: name + xxx + yyy + ::: + + - ::: name + xxx + yyy + ::: +. +
    +
  • +
    xxx
    +yyy
    +
    +
  • +
+

+-  ::: name
+ xxx
+yyy
+
+. diff --git a/tests/fixtures/container.md b/tests/fixtures/container.md new file mode 100644 index 0000000..9475b6a --- /dev/null +++ b/tests/fixtures/container.md @@ -0,0 +1,286 @@ + +Simple container +. +::: name +*content* +::: +. +
+

content

+
+. + +Delimiters too short +. +:: name +*content* +:: +. +

:: name +content +::

+. + + +Could contain block elements too +. +::: name +### heading + +----------- +::: +. +
+

heading

+
+
+. + + +Ending marker could be longer +. +::::: name ::::: + hello world +:::::::::::::::: +. +
+

hello world

+
+. + + +Nested blocks +. +::::: name +:::: name +xxx +:::: +::::: +. +
+
+

xxx

+
+
+. + + +Incorrectly nested blocks +. +:::: name +this block is closed with 5 markers below + +::::: name +auto-closed block + +::::: +:::: +. +
+

this block is closed with 5 markers below

+
+

auto-closed block

+
+
+

::::

+. + + +Marker could be indented up to 3 spaces +. + ::: name + content + ::: + ::: +. +
+

content +:::

+
+. + + +But that's a code block +. + ::: name + content + ::: +. +
::: name
+content
+:::
+
+. + + +Some more indent checks +. + ::: name + not a code block + + code block + ::: +. +
+

not a code block

+
code block
+
+
+. + + +Name could be adjacent to marker +. +:::name +xxx +::: +. +
+

xxx

+
+. + + +Or several spaces apart +. +::: name +xxx +::: +. +
+

xxx

+
+. + + +It could contain params +. +::: name arg=123 foo=456 +xxx +::: +. +
+

xxx

+
+. + + +But closing marker can't +. +::: name +xxx +::: arg=123 +. +
+

xxx +::: arg=123

+
+. + + +This however isn't a valid one +. +::: namename +xxx +::: +. +

::: namename +xxx +:::

+. + + +Containers self-close at the end of the document +. +::: name +xxx +. +
+

xxx

+
+. + + +They should terminate paragraphs +. +blah blah +::: name +content +::: +. +

blah blah

+
+

content

+
+. + + +They could be nested in lists +. + - ::: name + - xxx + ::: +. +
    +
  • +
    +
      +
    • xxx
    • +
    +
    +
  • +
+. + + +Or in blockquotes +. +> ::: name +> xxx +>> yyy +> zzz +> ::: +. +
+
+

xxx

+
+

yyy +zzz

+
+
+
+. + + +List indentation quirks +. + - ::: name + xxx + yyy + ::: + + - ::: name + xxx + yyy + ::: +. +
    +
  • +
    +

    xxx +yyy

    +
    +
  • +
+

:::

+
    +
  • +
    +

    xxx

    +
    +
  • +
+

yyy +:::

+. diff --git a/tests/fixtures/deflist.md b/tests/fixtures/deflist.md new file mode 100644 index 0000000..a32952d --- /dev/null +++ b/tests/fixtures/deflist.md @@ -0,0 +1,247 @@ + +Pandoc (with slightly changed indents): + +. +Term 1 + +: Definition 1 + +Term 2 with *inline markup* + +: Definition 2 + + { some code, part of Definition 2 } + + Third paragraph of definition 2. +. +
+
Term 1
+
+

Definition 1

+
+
Term 2 with inline markup
+
+

Definition 2

+
{ some code, part of Definition 2 }
+
+

Third paragraph of definition 2.

+
+
+. + +Pandoc again: + +. +Term 1 + +: Definition +with lazy continuation. + + Second paragraph of the definition. +. +
+
Term 1
+
+

Definition +with lazy continuation.

+

Second paragraph of the definition.

+
+
+. + +Well, I might just copy-paste the third one while I'm at it: + +. +Term 1 + ~ Definition 1 + +Term 2 + ~ Definition 2a + ~ Definition 2b +. +
+
Term 1
+
Definition 1
+
Term 2
+
Definition 2a
+
Definition 2b
+
+. + +Now, with our custom ones. Spaces after a colon: + +. +Term 1 + : paragraph + +Term 2 + : code block +. +
+
Term 1
+
paragraph
+
Term 2
+
+
code block
+
+
+
+. + +There should be something after a colon by the way: + +. +Non-term 1 + : + +Non-term 2 + : +. +

Non-term 1 +:

+

Non-term 2 +:

+. + + +List is tight iff all dts are tight: +. +Term 1 +: foo +: bar + +Term 2 +: foo + +: bar +. +
+
Term 1
+
+

foo

+
+
+

bar

+
+
Term 2
+
+

foo

+
+
+

bar

+
+
+. + + +Regression test (first paragraphs shouldn't be tight): +. +Term 1 +: foo + + bar +Term 2 +: foo +. +
+
Term 1
+
+

foo

+

bar +Term 2

+
+
+

foo

+
+
+. + +Definition lists should be second last in the queue. Exemplī grātiā, this isn't a valid one: + +. +# test + : just a paragraph with a colon +. +

test

+

: just a paragraph with a colon

+. + +Nested definition lists: + +. +test + : foo + : bar + : baz + : bar + : foo +. +
+
test
+
+
+
foo
+
+
+
bar
+
baz
+
+
+
bar
+
+
+
foo
+
+. + + +Regression test, tabs +. +Term 1 + : code block +. +
+
Term 1
+
+
code block
+
+
+
+. + + +Regression test (blockquote inside deflist) +. +foo +: > bar +: baz +. +
+
foo
+
+
+

bar

+
+
+
baz
+
+. + + +Coverage, 1 blank line +. +test + +. +

test

+. + + +Coverage, 2 blank lines +. +test + + +. +

test

+. diff --git a/tests/fixtures/dollar_math.md b/tests/fixtures/dollar_math.md new file mode 100644 index 0000000..a1c2d43 --- /dev/null +++ b/tests/fixtures/dollar_math.md @@ -0,0 +1,552 @@ +single dollar +. +$ +. +

$

+. + +double-dollar +. +$$ +. +

$$

+. + +single character inline equation. (valid=True) +. +$a$ +. +

a

+. + +inline equation with single greek character (valid=True) +. +$\\varphi$ +. +

\\varphi

+. + +simple equation starting and ending with numbers. (valid=True) +. +$1+1=2$ +. +

1+1=2

+. + +simple equation including special html character. (valid=True) +. +$1+1<3$ +. +

1+1<3

+. + +equation including backslashes. (valid=True) +. +$a \\backslash$ +. +

a \\backslash

+. + +use of currency symbol, i.e. digits before/after opening/closing (valid=True) +. +3$1+2$ $1+2$3 +. +

3$1+2$ $1+2$3

+. + +use of currency symbol (valid=True) +. +If you solve $1+2$ you get $3 +. +

If you solve 1+2 you get $3

+. + +inline fraction (valid=True) +. +$\\frac{1}{2}$ +. +

\\frac{1}{2}

+. + +inline column vector (valid=True) +. +$\\begin{pmatrix}x\\\\y\\end{pmatrix}$ +. +

\\begin{pmatrix}x\\\\y\\end{pmatrix}

+. + +inline bold vector notation (valid=True) +. +${\\tilde\\bold e}_\\alpha$ +. +

{\\tilde\\bold e}_\\alpha

+. + +exponentiation (valid=True) +. +$a^{b}$ +. +

a^{b}

+. + +conjugate complex (valid=True) +. +$a^\*b$ with $a^\*$ +. +

a^\*b with a^\*

+. + +Inline multi-line (valid=True) +. +a $a +\not=1$ b +. +

a a +\not=1 b

+. + +Inline multi-line with newline (valid=False) +. +a $a + +\not=1$ b +. +

a $a

+

\not=1$ b

+. + +single block equation, greek index (valid=True) +. +$$e_\\alpha$$ +. +
+e_\\alpha +
+. + +display equation on its own single line. (valid=True) +. +$$1+1=2$$ +. +
+1+1=2 +
+. + +display equation with number on its own single line. (valid=True) +. +$$1+1=2$$ (2) +. +
+ +1+1=2 +
+. + +inline equation followed by block equation. (valid=True) +. +${e}_x$ + +$$e_\\alpha$$ +. +

{e}_x

+
+e_\\alpha +
+. + +underline tests (valid=True) +. +$$c{\\bold e}_x = a{\\bold e}_\\alpha - b\\tilde{\\bold e}_\\alpha$$ +. +
+c{\\bold e}_x = a{\\bold e}_\\alpha - b\\tilde{\\bold e}_\\alpha +
+. + +non-numeric character before opening $ or +after closing $ or both is allowed. (valid=True) +. +a$1+1=2$ +$1+1=2$b +c$x$d +. +

a1+1=2 +1+1=2b +cxd

+. + +following dollar character '$' is allowed. (valid=True) +. +$x$ $ +. +

x $

+. + +consecutive inline equations. (valid=True) +. +$x$ $y$ +. +

x y

+. + +inline equation after '-' sign in text. (valid=True) +. +so-what is $x$ +. +

so-what is x

+. + +display equation with line breaks. (valid=True) +. +$$ +1+1=2 +$$ +. +
+1+1=2 +
+. + +multiple equations (valid=True) +. +$$ +a = 1 +$$ + +$$ +b = 2 +$$ +. +
+a = 1 +
+
+b = 2 +
+. + +equation followed by a labelled equation (valid=True) +. +$$ +a = 1 +$$ + +$$ +b = 2 +$$ (1) +. +
+a = 1 +
+
+ +b = 2 +
+. + +multiline equation. (valid=True) +. +$$\\begin{matrix} + f & = & 2 + x + 3 \\ + & = & 5 + x +\\end{matrix}$$ +. +
+\\begin{matrix} + f & = & 2 + x + 3 \\ + & = & 5 + x +\\end{matrix} +
+. + +vector equation. (valid=True) +. +$$\\begin{pmatrix}x_2 \\\\ y_2 \\end{pmatrix} = +\\begin{pmatrix} A & B \\\\ C & D \\end{pmatrix}\\cdot +\\begin{pmatrix} x_1 \\\\ y_1 \\end{pmatrix}$$ +. +
+\\begin{pmatrix}x_2 \\\\ y_2 \\end{pmatrix} = +\\begin{pmatrix} A & B \\\\ C & D \\end{pmatrix}\\cdot +\\begin{pmatrix} x_1 \\\\ y_1 \\end{pmatrix} +
+. + +display equation with equation number. (valid=True) +. +$$f(x) = x^2 - 1$$ (1) +. +
+ +f(x) = x^2 - 1 +
+. + +inline equation following code section. (valid=True) +. +`code`$a-b$ +. +

codea-b

+. + +equation following code block. (valid=True) +. +``` +code +``` +$$a+b$$ +. +
code
+
+
+a+b +
+. + +numbered equation following code block. (valid=True) +. +``` +code +``` +$$a+b$$(1) +. +
code
+
+
+ +a+b +
+. + +Equations in list. (valid=True) +. +1. $1+2$ +2. $2+3$ + 1. $3+4$ +. +
    +
  1. 1+2
  2. +
  3. 2+3 +
      +
    1. 3+4
    2. +
    +
  4. +
+. + +Inline sum. (valid=True) +. +$\\sum\_{i=1}^n$ +. +

\\sum\_{i=1}^n

+. + +Sum without equation number. (valid=True) +. +$$\\sum\_{i=1}^n$$ +. +
+\\sum\_{i=1}^n +
+. + +Sum with equation number. (valid=True) +. +$$\\sum\_{i=1}\^n$$ (2) +. +
+ +\\sum\_{i=1}\^n +
+. + +equation number always vertically aligned. (valid=True) +. +$${\\bold e}(\\varphi) = \\begin{pmatrix} +\\cos\\varphi\\\\\\sin\\varphi +\\end{pmatrix}$$ (3) +. +
+ +{\\bold e}(\\varphi) = \\begin{pmatrix} +\\cos\\varphi\\\\\\sin\\varphi +\\end{pmatrix} +
+. + +inline equations in blockquote. (valid=True) +. +> see $a = b + c$ +> $c^2=a^2+b^2$ (2) +> $c^2=a^2+b^2$ +. +
+

see a = b + c +c^2=a^2+b^2 (2) +c^2=a^2+b^2

+
+. + +display equation in blockquote. (valid=True) +. +> formula +> +> $$ a+b=c$$ (2) +> +> in blockquote. +. +
+

formula

+
+ +a+b=c +
+

in blockquote.

+
+. + +mixed syntax: +. +$$ +a=1 \\ +b=2 +$$ (abc) + +- ab $c=1$ d +. +
+ +a=1 \\ +b=2 +
+
    +
  • ab c=1 d
  • +
+. + +escaped dollars '\\$' are interpreted as +dollar '$' characters. (valid=True) +. +\\$1+1=2$ +$1+1=2\\$ +. +

\1+1=2 +1+1=2\\

+. + +empty line between text and display formula is required. (valid=False) +. +some text + \$\\$a+b=c\$\$ +. +

some text +$\$a+b=c$$

+. + +whitespace character after opening $ +or before closing $ is not allowed. (valid=False) +. +$ $ +$ x$ +$x $ +. +

$ $ +$ x$ +$x $

+. + +new line in blockquote block (valid=False): +. +> \$\$ a+b\n=c\$\$ +. +
+

$$ a+b\n=c$$

+
+. + +math-escaping: escaped start $: +. +\$p_2 = $a +. +

$p_2 = $a

+. + +math-escaping: escaped end $: +. +$p_2 = \$a +. +

$p_2 = $a

+. + +math-escaping: internal escaped $: +. +$p_2 = \$1$ +. +

p_2 = \$1

+. + +math-escaping: double-escaped start $: +. +\\$p_2 = 1$ +. +

\p_2 = 1

+. + +math-escaping: double-escaped end $: +. +$p_2 = \\$a +. +

p_2 = \\a

+. + +Inline double-dollar start: +. +$$a=1$$ b +. +

a=1
b

+. + +Inline double-dollar end: +. +a $$a=1$$ +. +

a

a=1

+. + +Inline double-dollar enclosed: +. +a $$a=1$$ (1) b +. +

a

a=1
(1) b

+. + +Inline double-dollar, escaped: +. +a \$$a=1$$ b +. +

a $a=1$ b

+. + +Inline mixed single/double dollars: +. +Hence, for $\alpha \in (0, 1)$, +$$ + \mathbb P (\alpha \bar{X} \ge \mu) \le \alpha; +$$ +i.e., $[\alpha \bar{X}, \infty)$ is a lower 1-sided $1-\alpha$ confidence bound for $\mu$. +. +

Hence, for \alpha \in (0, 1), +

\mathbb P (\alpha \bar{X} \ge \mu) \le \alpha;
+i.e., [\alpha \bar{X}, \infty) is a lower 1-sided 1-\alpha confidence bound for \mu.

+. + +display equation with label containing whitespace. (valid=True) +. +$$1+1=2$$ (a b) +. +
+ +1+1=2 +
+. diff --git a/tests/fixtures/field_list.md b/tests/fixtures/field_list.md new file mode 100644 index 0000000..bf31ad9 --- /dev/null +++ b/tests/fixtures/field_list.md @@ -0,0 +1,252 @@ +Body alignment: +. +:no body: + +:single line: content +:paragraph: content + running onto new line +:body inline: paragraph 1 + + paragraph 2 + + paragraph 3 + +:body on 2nd line: + paragraph 1 + + paragraph 2 + +:body on 3rd line: + + paragraph 1 + + paragraph 2 +. +
+
no body
+
+
single line
+
+

content

+
+
paragraph
+
+

content +running onto new line

+
+
body inline
+
+

paragraph 1

+

paragraph 2

+

paragraph 3

+
+
body on 2nd line
+
+

paragraph 1

+

paragraph 2

+
+
body on 3rd line
+
+

paragraph 1

+

paragraph 2

+
+
+. + +Empty name: +. +:: +. +

::

+. + +Whitespace only name: +. +: : +. +

: :

+. + +Name markup: +. +:inline *markup*: +. +
+
inline markup
+
+
+. + +Content paragraph markup: +. +:name: body *markup* +. +
+
name
+
+

body markup

+
+
+. + +Body list: +. +:name: + - item 1 + - item 2 +:name: - item 1 + - item 2 +. +
+
name
+
+
    +
  • item 1
  • +
  • item 2
  • +
+
+
name
+
+
    +
  • item 1
  • +
  • item 2
  • +
+
+
+. + +Body code block +. +:name: + code +:name: body + + code +. +
+
name
+
+
code
+
+
+
name
+
+

body

+
code
+
+
+
+. + +Body blockquote: +. +:name: + > item 1 + > item 2 +:name: > item 1 + > item 2 +. +
+
name
+
+
+

item 1 +item 2

+
+
+
name
+
+
+

item 1 +item 2

+
+
+
+. + +Body fence: +. +:name: + ```python + code + ``` +. +
+
name
+
+
code
+
+
+
+. + +Following blocks: +. +:name: body +- item 1 +:name: body +> block quote +:name: body +```python +code +``` +. +
+
name
+
+

body

+
+
+
    +
  • item 1
  • +
+
+
name
+
+

body

+
+
+
+

block quote

+
+
+
name
+
+

body

+
+
+
code
+
+. + +In list: +. +- :name: body +- item 2 +. +
    +
  • +
    +
    name
    +
    +

    body

    +
    +
    +
  • +
  • item 2
  • +
+. + +In blockquote: +. +> :name: body +. +
+
+
name
+
+

body

+
+
+
+. diff --git a/tests/fixtures/footnote.md b/tests/fixtures/footnote.md new file mode 100644 index 0000000..b0643e1 --- /dev/null +++ b/tests/fixtures/footnote.md @@ -0,0 +1,346 @@ + +Pandoc example: +. +Here is a footnote reference,[^1] and another.[^longnote] + +[^1]: Here is the footnote. + +[^longnote]: Here's one with multiple blocks. + + Subsequent paragraphs are indented to show that they +belong to the previous footnote. + + { some.code } + + The whole paragraph can be indented, or just the first + line. In this way, multi-paragraph footnotes work like + multi-paragraph list items. + +This paragraph won't be part of the note, because it +isn't indented. +. +

Here is a footnote reference,[1] and another.[2]

+

This paragraph won't be part of the note, because it +isn't indented.

+
+
+
    +
  1. Here is the footnote. ↩︎

    +
  2. +
  3. Here's one with multiple blocks.

    +

    Subsequent paragraphs are indented to show that they +belong to the previous footnote.

    +
    { some.code }
    +
    +

    The whole paragraph can be indented, or just the first +line. In this way, multi-paragraph footnotes work like +multi-paragraph list items. ↩︎

    +
  4. +
+
+. + + + +They could terminate each other: + +. +[^1][^2][^3] + +[^1]: foo +[^2]: bar +[^3]: baz +. +

[1][2][3]

+
+
+
    +
  1. foo ↩︎

    +
  2. +
  3. bar ↩︎

    +
  4. +
  5. baz ↩︎

    +
  6. +
+
+. + + +They could be inside blockquotes, and are lazy: +. +[^foo] + +> [^foo]: bar +baz +. +

[1]

+
+
+
+
    +
  1. bar +baz ↩︎

    +
  2. +
+
+. + + +Their labels could not contain spaces or newlines: + +. +[^ foo]: bar baz + +[^foo +]: bar baz +. +

[^ foo]: bar baz

+

[^foo +]: bar baz

+. + + +We support inline notes too (pandoc example): + +. +Here is an inline note.^[Inlines notes are easier to write, since +you don't have to pick an identifier and move down to type the +note.] +. +

Here is an inline note.[1]

+
+
+
    +
  1. Inlines notes are easier to write, since +you don't have to pick an identifier and move down to type the +note. ↩︎

    +
  2. +
+
+. + + +They could have arbitrary markup: + +. +foo^[ *bar* ] +. +

foo[1]

+
+
+
    +
  1. bar ↩︎

    +
  2. +
+
+. + + +Duplicate footnotes: +. +[^xxxxx] [^xxxxx] + +[^xxxxx]: foo +. +

[1] [1:1]

+
+
+
    +
  1. foo ↩︎ ↩︎

    +
  2. +
+
+. + + +Indents: + +. +[^xxxxx] [^yyyyy] + +[^xxxxx]: foo + --- + +[^yyyyy]: foo + --- +. +

[1] [2]

+
+
+
+
    +
  1. foo

    + ↩︎
  2. +
  3. foo ↩︎

    +
  4. +
+
+. + + +Indents for the first line: + +. +[^xxxxx] [^yyyyy] + +[^xxxxx]: foo + +[^yyyyy]: foo +. +

[1] [2]

+
+
+
    +
  1. foo ↩︎

    +
  2. +
  3. foo
    +
    +
  4. +
+
+. + +Indents for the first line (tabs): +. +[^xxxxx] + +[^xxxxx]: foo +. +

[1]

+
+
+
    +
  1. foo ↩︎

    +
  2. +
+
+. + + +Security 1 +. +[^__proto__] + +[^__proto__]: blah +. +

[1]

+
+
+
    +
  1. blah ↩︎

    +
  2. +
+
+. + + +Security 2 +. +[^hasOwnProperty] + +[^hasOwnProperty]: blah +. +

[1]

+
+
+
    +
  1. blah ↩︎

    +
  2. +
+
+. + + +Should allow links in inline footnotes +. +Example^[this is another example https://github.com] +. +

Example[1]

+
+
+
    +
  1. this is another example https://github.com ↩︎

    +
  2. +
+
+. + +Nested blocks: +. +[^a] + +[^a]: abc + + def +hij + + - list + + > block + +terminates here +. +

[1]

+

terminates here

+
+
+
    +
  1. abc

    +

    def +hij

    +
      +
    • list
    • +
    +
    +

    block

    +
    + ↩︎
  2. +
+
+. + +Empty lines after blockquote+footnote (markdown-it-py#133) +. +> b [^1] + +Some text + +> c + +[^1]: d + + +. +
+

b [1]

+
+

Some text

+
+

c

+
+
+
+
    +
  1. d ↩︎

    +
  2. +
+
+. + + +Newline after footnote identifier +. +[^a] + +[^a]: +b +. +

[1]

+

b

+
+
+
    +
  1. <-
  2. +
+
+. diff --git a/tests/fixtures/front_matter.md b/tests/fixtures/front_matter.md new file mode 100644 index 0000000..e01fd4e --- /dev/null +++ b/tests/fixtures/front_matter.md @@ -0,0 +1,87 @@ + +should parse empty front matter: +. +--- +--- +# Head +. + +

Head

+. + + +should parse basic front matter: +. +--- +x: 1 +--- +# Head +. + +

Head

+. + +should parse until triple dots: +. +--- +x: 1 +... +# Head +. + +

Head

+. + +should parse front matter with indentation: +. +--- +title: Associative arrays +people: + name: John Smith + age: 33 +morePeople: { name: Grace Jones, age: 21 } +--- +# Head +. + +

Head

+. + +should ignore spaces after front matter delimiters: +. +--- +title: Associative arrays +people: + name: John Smith + age: 33 +morePeople: { name: Grace Jones, age: 21 } +--- +# Head +. + +

Head

+. + +should ignore front matter with less than 3 opening dashes: +. +-- +x: 1 +-- +# Head +. +

-- +x: 1

+

Head

+. + +should require front matter have matching number of opening and closing dashes: +. +---- +x: 1 +--- +# Head +. +
+

x: 1

+

Head

+. diff --git a/tests/fixtures/myst_block.md b/tests/fixtures/myst_block.md new file mode 100644 index 0000000..90bf9d3 --- /dev/null +++ b/tests/fixtures/myst_block.md @@ -0,0 +1,149 @@ + +Block Break: +. ++++ +. +
+. + +Block Break Split Markers: +. + + + + + xfsdfsdf +. +
+. + +Block Break Too Few Markers: +. +++ +. +

++

+. + +Block Break terminates other blocks: +. +a ++++ +- b ++++ +> c ++++ +. +

a

+
+
    +
  • b
  • +
+
+
+

c

+
+
+. + +Target: +. +(a)= +. + +. + +Target characters: +. +(a bc |@<>*./_-+:)= +. + +. + +Empty target: +. +()= +. +

()=

+. + +Escaped target: +. +\(a)= +. +

(a)=

+. + +Indented target: +. + (a)= +. + +. + +Target terminates other blocks: +. +a +(a-b)= +- b +(a b)= +> c +(a)= +. +

a

+
    +
  • b
  • +
+
+

c

+
+ +. + +Comment: +. +% abc +. + +. + +Comment terminates other blocks: +. +a +% abc +- b +% abc +> c +% abc +. +

a

+
    +
  • b
  • +
+
+

c

+
+ +. + +Multiline comment: +. +a +% abc +% def +- b +% abc +%def +> c +%abc +% +%def +. +

a

+
    +
  • b
  • +
+
+

c

+
+ +. diff --git a/tests/fixtures/myst_role.md b/tests/fixtures/myst_role.md new file mode 100644 index 0000000..4b2c248 --- /dev/null +++ b/tests/fixtures/myst_role.md @@ -0,0 +1,104 @@ + +Basic: +. +{abc}`xyz` +. +

{abc}[xyz]

+. + +Multiple: +. +{abc}`xyz`{def}`uvw` +. +

{abc}[xyz]{def}[uvw]

+. + +Surrounding Text: +. +a {abc}`xyz` b +. +

a {abc}[xyz] b

+. + +New lines: +. +{abc}`xy +z` `d +e` +. +

{abc}[xy z] d e

+. + +In Code: +. +`` {abc}`xyz` `` +. +

{abc}`xyz`

+. + +Empty content: +. +{name}`` a +. +

{name}`` a

+. + +Surrounding Code: +. +`a` {abc}`xyz` `b` +. +

a {abc}[xyz] b

+. + +In list: +. +- {abc}`xyz` +. +
    +
  • {abc}[xyz]
  • +
+. + +In Quote: +. +> {abc}`xyz` b +. +
+

{abc}[xyz] b

+
+. + +Multiple ticks: +. +{abc}``xyz`` +. +

{abc}[xyz]

+. + +Inner tick: +. +{abc}``x`yz`` +. +

{abc}[x`yz]

+. + +Unbalanced ticks: +. +{abc}``xyz` +. +

{abc}``xyz`

+. + +Space in name: +. +{ab c}`xyz` +. +

{ab c}xyz

+. + +Escaped: +. +\{abc}`xyz` +. +

{abc}xyz

+. diff --git a/tests/fixtures/span.md b/tests/fixtures/span.md new file mode 100644 index 0000000..e69de29 diff --git a/tests/fixtures/substitution.md b/tests/fixtures/substitution.md new file mode 100644 index 0000000..1987354 --- /dev/null +++ b/tests/fixtures/substitution.md @@ -0,0 +1,125 @@ +Basic (space): +. +{{ block }} + +a {{ inline }} b +. +
+

a b

+. + +Basic (no space): +. +{{block}} + +a {{inline}} b +. +
+

a b

+. + +Same line: +. +{{a}}{{b}} +. +

+. + +No closing: +. +{{ a + +{{b} + +{{c} } +. +

{{ a

+

{{b}

+

{{c} }

+. + +Inside code +. +`{{ a }}` + +```python +{{b}} +``` +. +

{{ a }}

+
{{b}}
+
+. + +New line: +. +{{a}} +{{b}} +. +
+
+. + +Blocks: +. +- {{a}} + +> {{b}} + +1. {{c}} +. +
    +
  • +
    +
  • +
+
+
+
+
    +
  1. +
    +
  2. +
+. + +Inline: +. +- {{a}} x + +> {{b}} y + +1. {{c}} z +. +
    +
  • x
  • +
+
+

y

+
+
    +
  1. z
  2. +
+. + +Tables: +. +| | | +|-|-| +|{{a}}|{{b}} c| +. + + + + + + + + + + + + + +
c
+. diff --git a/tests/fixtures/tasklists.md b/tests/fixtures/tasklists.md new file mode 100644 index 0000000..dec0fef --- /dev/null +++ b/tests/fixtures/tasklists.md @@ -0,0 +1,131 @@ + +bullet.md: + +. +- [ ] unchecked item 1 +- [ ] unchecked item 2 +- [ ] unchecked item 3 +- [x] checked item 4 +. +
    +
  • unchecked item 1
  • +
  • unchecked item 2
  • +
  • unchecked item 3
  • +
  • checked item 4
  • +
+ +. + +dirty.md: + +. +- [ ] unchecked todo item 1 +- [ ] +- [ ] not a todo item 2 +- [ x] not a todo item 3 +- [x ] not a todo item 4 +- [ x ] not a todo item 5 +- [x] todo item 6 + +. +
    +
  • unchecked todo item 1
  • +
  • [ ]
  • +
  • [ ] not a todo item 2
  • +
  • [ x] not a todo item 3
  • +
  • [x ] not a todo item 4
  • +
  • [ x ] not a todo item 5
  • +
  • todo item 6
  • +
+ +. + +mixed-nested.md: + +. +# Test 1 + +1. foo + * [ ] nested unchecked item 1 + * not a todo item 2 + * not a todo item 3 + * [x] nested checked item 4 +2. bar +3. spam + +# Test 2 + +- foo + - [ ] nested unchecked item 1 + - [ ] nested unchecked item 2 + - [x] nested checked item 3 + - [X] nested checked item 4 + + +. +

Test 1

+
    +
  1. foo +
      +
    • nested unchecked item 1
    • +
    • not a todo item 2
    • +
    • not a todo item 3
    • +
    • nested checked item 4
    • +
    +
  2. +
  3. bar
  4. +
  5. spam
  6. +
+

Test 2

+
    +
  • foo +
      +
    • nested unchecked item 1
    • +
    • nested unchecked item 2
    • +
    • nested checked item 3
    • +
    • nested checked item 4
    • +
    +
  • +
+ +. + +oedered.md: + +. +1. [x] checked ordered 1 +2. [ ] unchecked ordered 2 +3. [x] checked ordered 3 +4. [ ] unchecked ordered 4 + +. +
    +
  1. checked ordered 1
  2. +
  3. unchecked ordered 2
  4. +
  5. checked ordered 3
  6. +
  7. unchecked ordered 4
  8. +
+ +. + +Tab after task list item marker +. ++ [x] item 1 ++ [ ] item 2 +. +
    +
  • item 1
  • +
  • item 2
  • +
+. + +Form feed after task list item marker +. ++ [x] item 1 ++ [ ] item 2 +. +
    +
  • item 1
  • +
  • item 2
  • +
+. diff --git a/tests/fixtures/texmath_bracket.md b/tests/fixtures/texmath_bracket.md new file mode 100644 index 0000000..330f4cb --- /dev/null +++ b/tests/fixtures/texmath_bracket.md @@ -0,0 +1,387 @@ +single character inline equation. (valid=True) +. +\(a\) +. +

a

+. + +inline equation with single greek character (valid=True) +. +\(\\varphi\) +. +

\\varphi

+. + +simple equation starting and ending with numbers. (valid=True) +. +\(1+1=2\) +. +

1+1=2

+. + +simple equation including special html character. (valid=True) +. +\(1+1<3\) +. +

1+1<3

+. + +equation including backslashes. (valid=True) +. +\(a \\backslash\) +. +

a \\backslash

+. + +use of currency symbol (valid=True) +. +You get 3$ if you solve \(1+2\) +. +

You get 3$ if you solve 1+2

+. + +use of currency symbol (valid=True) +. +If you solve \(1+2\) you get $3 +. +

If you solve 1+2 you get $3

+. + +inline fraction (valid=True) +. +\(\\frac{1}{2}\) +. +

\\frac{1}{2}

+. + +inline column vector (valid=True) +. +\(\\begin{pmatrix}x\\\\y\\end{pmatrix}\) +. +

\\begin{pmatrix}x\\\\y\\end{pmatrix}

+. + +inline bold vector notation (valid=True) +. +\({\\tilde\\bold e}_\\alpha\) +. +

{\\tilde\\bold e}_\\alpha

+. + +exponentiation (valid=True) +. +\(a^{b}\) +. +

a^{b}

+. + +conjugate complex (valid=True) +. +\(a^\*b\) with \(a^\*\) +. +

a^\*b with a^\*

+. + +Inline multi-line (valid=True) +. +a \(a +\not=1\) b +. +

a a +\not=1 b

+. + +Inline multi-line with newline (valid=False) +. +a \(a + +\not=1\) b +. +

a (a

+

\not=1) b

+. + +single block equation, greek index (valid=True) +. +\[e_\\alpha\] +. +
+e_\\alpha +
+. + +display equation on its own single line. (valid=True) +. +\[1+1=2\] +. +
+1+1=2 +
+. + +inline equation followed by block equation. (valid=True) +. +\({e}_x\) + +\[e_\\alpha\] +. +

{e}_x

+
+e_\\alpha +
+. + +underline tests (valid=True) +. +\[c{\\bold e}_x = a{\\bold e}_\\alpha - b\\tilde{\\bold e}_\\alpha\] +. +
+c{\\bold e}_x = a{\\bold e}_\\alpha - b\\tilde{\\bold e}_\\alpha +
+. + +non-numeric character before opening $ or +after closing $ or both is allowed. (valid=True) +. +a\(1+1=2\) +\(1+1=2\)b +c\(x\)d +. +

a1+1=2 +1+1=2b +cxd

+. + +following dollar character '$' is allowed. (valid=True) +. +\(x\) $ +. +

x $

+. + +consecutive inline equations. (valid=True) +. +\(x\) \(y\) +. +

x y

+. + +inline equation after '-' sign in text. (valid=True) +. +so-what is \(x\) +. +

so-what is x

+. + +display equation with line breaks. (valid=True) +. +\[ +1+1=2 +\] +. +
+ +1+1=2 + +
+. + +multiple equations (valid=True) +. +\[ +a = 1 +\] + +\[ +b = 2 +\] +. +
+ +a = 1 + +
+
+ +b = 2 + +
+. + +equation followed by a labelled equation (valid=True) +. +\[ +a = 1 +\] + +\[ +b = 2 +\] (1) +. +
+ +a = 1 + +
+
+ +b = 2 + +
+. + +multiline equation. (valid=True) +. +\[\\begin{matrix} + f & = & 2 + x + 3 \\ + & = & 5 + x +\\end{matrix}\] +. +
+\\begin{matrix} + f & = & 2 + x + 3 \\ + & = & 5 + x +\\end{matrix} +
+. + +vector equation. (valid=True) +. +\[\\begin{pmatrix}x_2 \\\\ y_2 \\end{pmatrix} = +\\begin{pmatrix} A & B \\\\ C & D \\end{pmatrix}\\cdot +\\begin{pmatrix} x_1 \\\\ y_1 \\end{pmatrix}\] +. +
+\\begin{pmatrix}x_2 \\\\ y_2 \\end{pmatrix} = +\\begin{pmatrix} A & B \\\\ C & D \\end{pmatrix}\\cdot +\\begin{pmatrix} x_1 \\\\ y_1 \\end{pmatrix} +
+. + +display equation with equation number. (valid=True) +. +\[f(x) = x^2 - 1\] (1) +. +
+f(x) = x^2 - 1 +
+. + +inline equation following code section. (valid=True) +. +`code`\(a-b\) +. +

codea-b

+. + +equation following code block. (valid=True) +. +``` +code +``` +\[a+b\] +. +
code
+
+
+a+b +
+. + +numbered equation following code block. (valid=True) +. +``` +code +``` +\[a+b\](1) +. +
code
+
+
+a+b +
+. + +Equations in list. (valid=True) +. +1. \(1+2\) +2. \(2+3\) + 1. \(3+4\) +. +
    +
  1. 1+2
  2. +
  3. 2+3 +
      +
    1. 3+4
    2. +
    +
  4. +
+. + +Inline sum. (valid=True) +. +\(\\sum\_{i=1}^n\) +. +

\\sum\_{i=1}^n

+. + +Sum without equation number. (valid=True) +. +\[\\sum\_{i=1}^n\] +. +
+\\sum\_{i=1}^n +
+. + +Sum with equation number. (valid=True) +. +\[\\sum\_{i=1}\^n\] \(2\) +. +
+\\sum\_{i=1}\^n +
+. + +equation number always vertically aligned. (valid=True) +. +\[{\\bold e}(\\varphi) = \\begin{pmatrix} +\\cos\\varphi\\\\\\sin\\varphi +\\end{pmatrix}\] (3) +. +
+{\\bold e}(\\varphi) = \\begin{pmatrix} +\\cos\\varphi\\\\\\sin\\varphi +\\end{pmatrix} +
+. + +inline equations in blockquote. (valid=True) +. +> see \(a = b + c\) +> \(c^2=a^2+b^2\) (2) +> \(c^2=a^2+b^2\) +. +
+

see a = b + c +c^2=a^2+b^2 (2) +c^2=a^2+b^2

+
+. + +display equation in blockquote. (valid=True) +. +> formula +> +> \[ a+b=c\] (2) +> +> in blockquote. +. +
+

formula

+
+ a+b=c +
+

in blockquote.

+
+. diff --git a/tests/fixtures/texmath_dollar.md b/tests/fixtures/texmath_dollar.md new file mode 100644 index 0000000..bada6fe --- /dev/null +++ b/tests/fixtures/texmath_dollar.md @@ -0,0 +1,438 @@ +single character inline equation. (valid=True) +. +$a$ +. +

a

+. + +inline equation with single greek character (valid=True) +. +$\\varphi$ +. +

\\varphi

+. + +simple equation starting and ending with numbers. (valid=True) +. +$1+1=2$ +. +

1+1=2

+. + +simple equation including special html character. (valid=True) +. +$1+1<3$ +. +

1+1<3

+. + +equation including backslashes. (valid=True) +. +$a \\backslash$ +. +

a \\backslash

+. + +use of currency symbol (valid=True) +. +You get 3$ if you solve $1+2$ +. +

You get 3$ if you solve 1+2

+. + +use of currency symbol (valid=True) +. +If you solve $1+2$ you get $3 +. +

If you solve 1+2 you get $3

+. + +inline fraction (valid=True) +. +$\\frac{1}{2}$ +. +

\\frac{1}{2}

+. + +inline column vector (valid=True) +. +$\\begin{pmatrix}x\\\\y\\end{pmatrix}$ +. +

\\begin{pmatrix}x\\\\y\\end{pmatrix}

+. + +inline bold vector notation (valid=True) +. +${\\tilde\\bold e}_\\alpha$ +. +

{\\tilde\\bold e}_\\alpha

+. + +exponentiation (valid=True) +. +$a^{b}$ +. +

a^{b}

+. + +conjugate complex (valid=True) +. +$a^\*b$ with $a^\*$ +. +

a^\*b with a^\*

+. + +Inline multi-line (valid=True) +. +a $a +\not=1$ b +. +

a a +\not=1 b

+. + +Inline multi-line with newline (valid=False) +. +a $a + +\not=1$ b +. +

a $a

+

\not=1$ b

+. + +single block equation, greek index (valid=True) +. +$$e_\\alpha$$ +. +
+e_\\alpha +
+. + +display equation on its own single line. (valid=True) +. +$$1+1=2$$ +. +
+1+1=2 +
+. + +inline equation followed by block equation. (valid=True) +. +${e}_x$ + +$$e_\\alpha$$ +. +

{e}_x

+
+e_\\alpha +
+. + +underline tests (valid=True) +. +$$c{\\bold e}_x = a{\\bold e}_\\alpha - b\\tilde{\\bold e}_\\alpha$$ +. +
+c{\\bold e}_x = a{\\bold e}_\\alpha - b\\tilde{\\bold e}_\\alpha +
+. + +non-numeric character before opening $ or +after closing $ or both is allowed. (valid=True) +. +a$1+1=2$ +$1+1=2$b +c$x$d +. +

a1+1=2 +1+1=2b +cxd

+. + +following dollar character '$' is allowed. (valid=True) +. +$x$ $ +. +

x $

+. + +consecutive inline equations. (valid=True) +. +$x$ $y$ +. +

x y

+. + +inline equation after '-' sign in text. (valid=True) +. +so-what is $x$ +. +

so-what is x

+. + +display equation with line breaks. (valid=True) +. +$$ +1+1=2 +$$ +. +
+ +1+1=2 + +
+. + +multiple equations (valid=True) +. +$$ +a = 1 +$$ + +$$ +b = 2 +$$ +. +
+ +a = 1 + +
+
+ +b = 2 + +
+. + +equation followed by a labelled equation (valid=True) +. +$$ +a = 1 +$$ + +$$ +b = 2 +$$ (1) +. +
+ +a = 1 + +
+
+ +b = 2 + +
+. + +multiline equation. (valid=True) +. +$$\\begin{matrix} + f & = & 2 + x + 3 \\ + & = & 5 + x +\\end{matrix}$$ +. +
+\\begin{matrix} + f & = & 2 + x + 3 \\ + & = & 5 + x +\\end{matrix} +
+. + +vector equation. (valid=True) +. +$$\\begin{pmatrix}x_2 \\\\ y_2 \\end{pmatrix} = +\\begin{pmatrix} A & B \\\\ C & D \\end{pmatrix}\\cdot +\\begin{pmatrix} x_1 \\\\ y_1 \\end{pmatrix}$$ +. +
+\\begin{pmatrix}x_2 \\\\ y_2 \\end{pmatrix} = +\\begin{pmatrix} A & B \\\\ C & D \\end{pmatrix}\\cdot +\\begin{pmatrix} x_1 \\\\ y_1 \\end{pmatrix} +
+. + +display equation with equation number. (valid=True) +. +$$f(x) = x^2 - 1$$ (1) +. +
+f(x) = x^2 - 1 +
+. + +inline equation following code section. (valid=True) +. +`code`$a-b$ +. +

codea-b

+. + +equation following code block. (valid=True) +. +``` +code +``` +$$a+b$$ +. +
code
+
+
+a+b +
+. + +numbered equation following code block. (valid=True) +. +``` +code +``` +$$a+b$$(1) +. +
code
+
+
+a+b +
+. + +Equations in list. (valid=True) +. +1. $1+2$ +2. $2+3$ + 1. $3+4$ +. +
    +
  1. 1+2
  2. +
  3. 2+3 +
      +
    1. 3+4
    2. +
    +
  4. +
+. + +Inline sum. (valid=True) +. +$\\sum\_{i=1}^n$ +. +

\\sum\_{i=1}^n

+. + +Sum without equation number. (valid=True) +. +$$\\sum\_{i=1}^n$$ +. +
+\\sum\_{i=1}^n +
+. + +Sum with equation number. (valid=True) +. +$$\\sum\_{i=1}\^n$$ \(2\) +. +
+\\sum\_{i=1}\^n +
+. + +equation number always vertically aligned. (valid=True) +. +$${\\bold e}(\\varphi) = \\begin{pmatrix} +\\cos\\varphi\\\\\\sin\\varphi +\\end{pmatrix}$$ (3) +. +
+{\\bold e}(\\varphi) = \\begin{pmatrix} +\\cos\\varphi\\\\\\sin\\varphi +\\end{pmatrix} +
+. + +inline equations in blockquote. (valid=True) +. +> see $a = b + c$ +> $c^2=a^2+b^2$ (2) +> $c^2=a^2+b^2$ +. +
+

see a = b + c +c^2=a^2+b^2 (2) +c^2=a^2+b^2

+
+. + +display equation in blockquote. (valid=True) +. +> formula +> +> $$ a+b=c$$ (2) +> +> in blockquote. +. +
+

formula

+
+ a+b=c +
+

in blockquote.

+
+. + +mixed syntax: +. +$$ +a=1 \\ +b=2 +$$ (abc) + +- ab $c=1$ d +. +
+ +a=1 \\ +b=2 + +
+
    +
  • ab c=1 d
  • +
+. + +escaped dollars '\\$' are interpreted as +dollar '$' characters. (valid=True) +. +\\$1+1=2$ +$1+1=2\\$ +. +

\$1+1=2$ +$1+1=2\$

+. + +empty line between text and display formula is required. (valid=False) +. +some text + \$\\$a+b=c\$\$ +. +

some text +$\$a+b=c$$

+. + +whitespace character after opening $ +or before closing $ is not allowed. (valid=False) +. +$ $ +$ x$ +$x $ +. +

$ $ +$ x$ +$x $

+. diff --git a/tests/fixtures/wordcount.md b/tests/fixtures/wordcount.md new file mode 100644 index 0000000..e9c7948 --- /dev/null +++ b/tests/fixtures/wordcount.md @@ -0,0 +1,51 @@ +syntax (text) +. +one two +three four + +- five six + +> seven eight + +[nine ten](link) +. +{ + "minutes": 0, + "text": [ + "one two", + "three four", + "five six", + "seven eight", + "nine ten" + ], + "words": 10 +} +. + +non-words +. +Geeksforgeeks, is best @# Computer Science Portal.!!! +. +{ + "minutes": 0, + "words": 6 +} +. + +lore ipsum +. +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent imperdiet hendrerit dictum. Etiam diam turpis, cursus in varius dignissim, imperdiet nec nibh. Nulla nec finibus dui. Phasellus fermentum venenatis placerat. Donec ut dui in sem rhoncus molestie. Sed auctor sem dapibus augue varius facilisis. Maecenas at suscipit dolor. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vestibulum ornare dui ac tristique ultricies. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque arcu erat, ultricies ac lorem at, semper ornare nisl. + +Donec massa magna, commodo et ultrices ac, rutrum non nulla. Nunc fermentum fringilla ultrices. Morbi ante nibh, accumsan ac viverra quis, gravida rutrum mi. Integer lobortis, purus id laoreet ornare, sapien odio placerat massa, vel vestibulum dolor ante id mi. Donec ex leo, ultricies non ante eget, pharetra dictum orci. Interdum et malesuada fames ac ante ipsum primis in faucibus. Maecenas vitae tortor ut nisi cursus egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Morbi et nunc posuere, pharetra est aliquet, iaculis libero. Aliquam leo nibh, posuere eget eros a, convallis bibendum nibh. Phasellus vulputate bibendum lacus sit amet varius. Integer ut rutrum dolor, ac finibus neque. Maecenas ultrices pretium augue vitae mollis. Fusce semper lorem eu mauris iaculis pulvinar. + +Morbi ac pretium nunc, ac faucibus enim. Duis consequat nibh metus, at sodales sem luctus nec. Donec id finibus ante. Duis tincidunt vulputate efficitur. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Aenean porttitor augue consectetur, feugiat odio in, rutrum velit. Aliquam et mi lacinia, efficitur nisl nec, rutrum mauris. Mauris efficitur eros in maximus tempor. Suspendisse potenti. Quisque cursus non libero in faucibus. Etiam dignissim urna vel nibh feugiat, at vehicula dui vulputate. + +Praesent malesuada arcu quis neque condimentum vestibulum. Aliquam pretium eleifend neque, eget vulputate erat faucibus at. Quisque egestas nunc ac hendrerit fringilla. Vestibulum at tristique lacus, eget placerat risus. Aenean a metus ullamcorper, eleifend ante ut, feugiat lacus. Proin eget semper purus, ac vehicula nisl. Suspendisse eu mi enim. Nullam aliquam purus eu orci iaculis suscipit. Mauris dapibus non neque eu hendrerit. Sed eros purus, finibus ut ex ac, ultricies luctus enim. Quisque non lacus arcu. Ut dictum mauris ac tristique pulvinar. Aenean ut nisl massa. Donec nec dui scelerisque, egestas arcu sit amet, tempor eros. + +Donec sit amet faucibus tellus. Cras auctor mi id quam rhoncus, eget porttitor magna ultrices. Sed tristique ut augue in facilisis. Duis in finibus diam. In hac habitasse platea dictumst. Vestibulum in pulvinar orci. Sed a justo cursus enim ultrices egestas sed sit amet leo. Donec sed auctor urna. Praesent vitae dapibus ipsum. Nulla facilisi. Pellentesque non nisi sem. Sed ac mi rutrum, blandit purus ut, facilisis ipsum. +. +{ + "minutes": 2, + "words": 458 +} +. -- cgit v1.2.3