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

Add contentLevel Lua option and a \markinline plain TeX command #300

Closed
2 tasks done
Witiko opened this issue Apr 28, 2023 · 1 comment · Fixed by #439
Closed
2 tasks done

Add contentLevel Lua option and a \markinline plain TeX command #300

Witiko opened this issue Apr 28, 2023 · 1 comment · Fixed by #439
Assignees
Labels
feature request latex Related to the LaTeX interface and implementation lua Related to the Lua interface and implementation plaintex Related to the plain TeX interface and implementation quality of life Related to quality-of-life improvements to the interface
Milestone

Comments

@Witiko
Copy link
Owner

Witiko commented Apr 28, 2023

Currently, we only support including whole Markdown documents using the \markdownInput and \markdownBegin ... End commands. However, it would be useful to allow including just inline elements using a command \markinline with a syntax similar to \mintinline from the minted package:


Hello, \markinline{*world*} !

Expected output: Hello, world !


In LaTeX, the command would also support optional arguments similar to the \markdownInput command and the \begin{markdown} enviroment (see #299).

At the level of Lua, we would add a new option contentLevel, which could have two values: block or inline. The default value would be inline for the \markinline command and block in general. For contentLevel of inline, only a series of inline level elements would be allowed in reader->convert(). For contentLevel of block, the behavior would be the same as it is now.

Tasks

  • Add contentType Lua option.
  • Add plain TeX command \markinline.
@Witiko Witiko added feature request help wanted lua Related to the Lua interface and implementation plaintex Related to the plain TeX interface and implementation latex Related to the LaTeX interface and implementation quality of life Related to quality-of-life improvements to the interface labels Apr 28, 2023
@Witiko Witiko added this to the 3.2.0 milestone Apr 28, 2023
@Witiko Witiko changed the title Add contentLevel option and a \markinline command Add contentLevel Lua option and a \markinline plain TeX command Apr 28, 2023
@Witiko Witiko removed the markdown3 label Aug 30, 2023
@Witiko Witiko modified the milestones: 3.2.0, 3.3.0 Oct 18, 2023
@Witiko Witiko modified the milestones: 3.3.0, 3.4.0 Dec 16, 2023
@Witiko Witiko modified the milestones: 3.4.0, 3.5.0 Jan 31, 2024
@Witiko
Copy link
Owner Author

Witiko commented Feb 12, 2024

Here are some thoughts regarding the \markinline command:

  1. It would be neat if we could support "braceless" invocation, i.e. if users could write not only \markinline{*Hello, world!*} and \markinline"*Hello, world!*" but also \markinline *Hello, world!*. This would allow users to shorthand \markinline to e.g. \m and type markdown in TeX with little visual noise. On the technical side of things, TeX would likely not distinguish * from " and stripping " / not stripping * would happen in Lua. The approach should be extensible, i.e. \markinline ~~deleted text~~ should produce "deleted text" when strikeThrough is enabled and "~deleted text~" otherwise.

    We should be able to do this by converting the original text and seeing if the initial and final characters from the input are still present in the output. If they are, they do not surround an element, so we strip them and repeat the conversion. Otherwise, we return the result of the conversion. To maintain correctness, we should only do this when we use \markinline without {}, i.e. when the text starts and ends with the same character and a new internal option _stripDelimiters is enabled. To prevent repeated conversion when users don't use braceless invocation speed, we should only do this when the surrounding characters are special characters.

  2. Currently, all buffering commands all produce a temporary file with the markdown text that is then processed by \markdownInput. While this is conceptually simple, it requires the creation of a needless temporary file in LuaTeX. In the next major release, we should decouple \markinline and \markdownReadAndConvert from \markdownInput, buffer the text in a token list and have LuaTeX access that token list directly.

@Witiko Witiko modified the milestones: 3.4.3, 3.5.0 Mar 29, 2024
@Witiko Witiko modified the milestones: 3.5.0, 3.5.1 Apr 29, 2024
@Witiko Witiko changed the title Add contentLevel Lua option and a \markinline plain TeX command Add contentLevel Lua option and a \markinline plain TeX and LaTeX commands Apr 29, 2024
@Witiko Witiko changed the title Add contentLevel Lua option and a \markinline plain TeX and LaTeX commands Add contentLevel Lua option and a \markinline plain TeX command Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request latex Related to the LaTeX interface and implementation lua Related to the Lua interface and implementation plaintex Related to the plain TeX interface and implementation quality of life Related to quality-of-life improvements to the interface
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants