Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List indentation is fragile in ConTeXt #329

Closed
andreiborisov opened this issue Aug 20, 2023 · 1 comment · Fixed by #342
Closed

List indentation is fragile in ConTeXt #329

andreiborisov opened this issue Aug 20, 2023 · 1 comment · Fixed by #342
Labels
bug documentation Related the technical documentation, the user manual, and the README files
Milestone

Comments

@andreiborisov
Copy link

Missing one space symbol in item indentation causes compilation to fail. Here is an example:

- First element
- Second element
   #. First subelement
    #. Second subelement
- Third element

That transforms to:

\markdownRendererUlBeginTight
\markdownRendererUlItem First element\markdownRendererUlItemEnd 
\markdownRendererUlItem Second element #. First subelement\markdownRendererInterblockSeparator
{}\markdownRendererOlBeginTight
\markdownRendererOlItem Second subelement\markdownRendererOlItemEnd 
\markdownRendererOlEndTight \markdownRendererUlItemEnd 
\markdownRendererUlItem Third element\markdownRendererUlItemEnd 
\markdownRendererUlEndTight \relax

Which fails to compile:

You can't use 'parameter character U+0023 'hash tag'' in horizontal mode

<line 11.3> 
    \markdownRendererUlItem Second element #
    . First subelement\markdownRendererInterblockSeparator

1     \markdownRendererUlBeginTight
2     \markdownRendererUlItem First element\markdownRendererUlItemEnd 
3 >>  \markdownRendererUlItem Second element #. First subelement\markdownRendererInterblockSeparator
4     {}\markdownRendererOlBeginTight
5     \markdownRendererOlItem Second subelement\markdownRendererOlItemEnd 
6     \markdownRendererOlEndTight \markdownRendererUlItemEnd 
7     \markdownRendererUlItem Third element\markdownRendererUlItemEnd 
8     \markdownRendererUlEndTight \relax
@Witiko Witiko added bug documentation Related the technical documentation, the user manual, and the README files labels Aug 20, 2023
@Witiko Witiko added this to the 3.0.0 milestone Aug 20, 2023
@Witiko
Copy link
Owner

Witiko commented Aug 20, 2023

In the ConTeXt module (as well as in the plain TeX and LaTeX modules and in the OpTeX example), we change the catcodes of characters % and # to category 12 (other) before we input the transformed document:

markdown/markdown.dtx

Lines 31555 to 31572 in 6918a31

|gdef|markdownInput#1{%
% \end{macrocode}
% \begin{markdown}
% Change the category code of the percent sign (`\%`) to other, so that a user
% of the \Opt{hybrid} Lua option or a malevolent actor can't produce TeX
% comments in the plain TeX output of the Markdown package.
% \end{markdown}
% \begin{macrocode}
|begingroup
|catcode`|%=12
% \end{macrocode}
% \begin{markdown}
% Furthermore, also change the category code of the hash sign (`#`) to other,
% so that it's safe to tokenize the plain TeX output without mistaking hash
% signs with TeX's parameter numbers.
% \end{markdown}
% \begin{macrocode}
|catcode`|#=12

This causes # to be typeset as a hash sign.

You should set the catcodes before manually inputting the transformed document as follows:

\begingroup
\catcode`\%=12
\catcode`\#=12
Here goes the transformed document.
\endgroup

I can see that this is not properly documented in the user manual:

This will need fixing before the 3.0.0 release. Thanks for the report.

@andreiborisov, did you notice any other place in the documentation, where this should be stressed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug documentation Related the technical documentation, the user manual, and the README files
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants