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

Implement the tex formatter and TexThemeRenderer #1183

Merged
merged 3 commits into from
Jun 23, 2019
Merged

Conversation

jneen
Copy link
Member

@jneen jneen commented Jun 13, 2019

Implements TeX rendering. This is split into two parts:

  • TexThemeRenderer - The "theme" rendering, which defines a basic set of commands and the colors to be rendered
  • Formatters::Tex - Outputs escaped and marked tokens in the format
\begin{RG*}%         surrounding RG* environment, redefinable by the user
\RG{k}{def}\newline% tokens rendered with a single two-argument command that takes the shortname first
\phantom{xxxx}\RG{c}{indented content}% render empty space at the beginning of lines
\end{RG*}%

I would appreciate the feedback of someone with some experience in TeX before merging this.

@jneen
Copy link
Member Author

jneen commented Jun 13, 2019

The "RG" prefix can also be modified by the user from the CLI, with --tex-prefix.

@jneen
Copy link
Member Author

jneen commented Jun 13, 2019

This is a proof-of-concept TeX library that uses this feature to render highlighted content: https://gist.github.com/jneen/b938c1b34c2ec57bd7477cae8c8fdac5

@ccshan
Copy link

ccshan commented Jun 14, 2019

Nice. I would use \hphantom for indentation. Also is it worth documenting how special characters are escaped?

@pyrmont pyrmont added the needs-review The PR needs to be reviewed label Jun 14, 2019
@jneen jneen force-pushed the feature.tex branch 2 times, most recently from 38de52b to 0086498 Compare June 23, 2019 04:22
@jneen
Copy link
Member Author

jneen commented Jun 23, 2019

I think this is ready to merge! I have a patch that will allow extra escaping if need be, but the end user can always redefine the RG* environment using fancyvrb or similar.

@pyrmont pyrmont merged commit 074fe64 into master Jun 23, 2019
@pyrmont pyrmont removed the needs-review The PR needs to be reviewed label Jun 23, 2019
@tancnle tancnle deleted the feature.tex branch September 22, 2021 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants