leovan / quarto-pseudocode

Quarto Pseudocode Extension
MIT License
38 stars 2 forks source link

[Feature Request] Request to add support for quarto `{.content-visible}` and varients #2

Closed PeterWang-dev closed 1 year ago

PeterWang-dev commented 1 year ago

When qmd needs to be rendered into formats extension not support (such as docx), I'd like to include a screenshot rather than code block. But seems like Lua script of this extension doesn't support quarto block.

Example:

::: {.content-visible when-format="pdf"}
\`\`\`pseudocode
#| label: alg-test-text-style
#| html-indent-size: "1.2em"
#| html-comment-delimiter: "//"
#| html-line-number: true
#| html-line-number-punc: ":"
#| html-no-end: false
#| pdf-placement: "htb!"
#| pdf-line-number: true

\begin{algorithm}
\caption{Test text-style}
\begin{algorithmic}
\Require some preconditions
\Ensure some postconditions
\Procedure{Test-Declarations}{}
  \State font families: {\sffamily sffamily, \ttfamily ttfamily, \normalfont normalfont, \rmfamily rmfamily.}
  \State font weights: {normal weight, \bfseries bold, \mdseries medium. }
  \State font shapes: {\itshape itshape \scshape Small-Caps \slshape slshape \upshape upshape.}
  \State font sizes: \tiny tiny \scriptsize scriptsize \footnotesize
  footnotesize \small small \normalsize normal \large large \Large Large
  \LARGE LARGE \huge huge \Huge Huge \normalsize
\EndProcedure
\Procedure{Test-Commands}{}
  \State \textnormal{textnormal,} \textrm{textrm,} \textsf{textsf,} \texttt{texttt.}
  \State \textbf{textbf,} \textmd{textmd.}
  \State \textup{textup,} \textit{textit,} \textsc{textsc,} \textsl{textsl.}
  \State \uppercase{uppercase,} \lowercase{LOWERCASE.}
\EndProcedure
\Procedure{Test-Colors}{}
  \State \Comment{feature not implemented}
\EndProcedure
\end{algorithmic}
\end{algorithm}
\`\`\`
:::

Result:

image

The pseudocode block is directly rendered into vanilla code block.

Requested Feature:

image

The block can still be rendered into algorithms environment when using quarto blocks.

leovan commented 1 year ago

Done with https://github.com/leovan/quarto-pseudocode/commit/47de25d153a6e4cf02bd6b17e4a572c45f1118b7, but this feature requires quarto v1.4.