Skip to content

Pre-processing text in \markdownInput using lua function #252

Answered by Witiko
michaelstepner asked this question in Q&A
Discussion options

You must be logged in to vote

It seems to me that you are missing a % before the s* in the following line:

s = s:gsub ( "{{s*variable%s*}}" , "successful test" )

Otherwise, your solution should work. If you'd like your solution to work with the \markdownInput command as well and can grok using LPEG instead of regular expressions, then writing a user-defined syntax extension may be more appropriate.

Another solution would be to redefine the macro that renders left braces and do the variable expansion in TeX. This will also work with both \begin{markdown} ... \end{markdown} and \markdownInput, similarly to syntax extensions.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@michaelstepner
Comment options

@Witiko
Comment options

@Witiko
Comment options

Answer selected by Witiko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
syntax extension Related to syntax extensions and dialects of markdown
2 participants