lostenderman / markdown

:notebook_with_decorative_cover: A package for converting and rendering markdown documents in TeX
http://ctan.org/pkg/markdown
LaTeX Project Public License v1.3c
1 stars 0 forks source link

Character escaping #137

Closed lostenderman closed 1 year ago

lostenderman commented 1 year ago

Closes #36. Closes #101.

lostenderman commented 1 year ago

There is a problem with including tildes in a programmatic text when running the tests.

Example

``` ~
```
BEGIN fencedCode
- src: ./_markdown_test/d41d8cd98f00b204e9800998ecf8427e.verbatim
- infostring: \CCC:7:126 
END fencedCode

Should something like this be added to the test in question?

\catcode"7E=12%

Or something more global?

...

Note that there is currently this line "resolving" this:

\catcode"7E=12% Prevent tildes (U+007E) from being active in programmatic text.

Witiko commented 1 year ago

Let's add it to tests/support/setup.tex? For pipes, which are special in ConTeXt, we added a similar command to tests/templates/context/*.m4, which we may want to move to tests/support/setup.tex for simplicity.

lostenderman commented 1 year ago

Something like this then?

setup.tex

\long\def\TYPE#1{%
  \catcode"7C=12%  Prevent pipes (U+007C) from being active in ConTeXt
  \catcode"7E=12%  Prevent tildes (U+007E) from being active in programmatic text
  \begingroup

There are also these two in plain-setup.tex and markdownthemewitiko_markdown_test.sty currently:

\catcode"09=12%  Prevent tabs (U+0009) from folding into a single space token
\catcode"20=12%  Prevent spaces (U+0020) from folding into a single space token

I suppose I also add them there?

Witiko commented 1 year ago

I suppose I also add them there?

Let's just add them there. There is no point in changing category codes at the beginning of the \TYPE command, since by then, the arguments will already have been assigned category codes.