DEV Community

Mingming Ma
Mingming Ma

Posted on

SOPS, and Rendering Latex

This blog post will address the remaining questions from the previous one: understanding the encryption and decryption processes of SOPS, and introducing new developments regarding math rendering.

SOPS

SOPS (Secrets OPerationS) is a tool for safely encrypting, decrypting, and managing secrets in files. It plays a crucial role in ensuring the protection of sensitive information within configuration files.

I have created a Wiki page, providing an overview of the encryption and decryption processes of SOPS. Check this out!

Rendering Latex in ChatCraft

In this week, I have also implemented(PR349,PR353) rendering Latex by using remark-math and Katex Plugins.

Here are the rendering results:

equation1

equation2

Here is how to use those plugins:

import ReactMarkdown from "react-markdown";
import remarkMath from "remark-math";
import rehypeKatex from "rehype-katex";
import "katex/dist/katex.min.css";

//...
    <ReactMarkdown
      remarkPlugins={[remarkMath, { singleDollarTextMath: false }]}
      rehypePlugins={[rehypeKatex]}
      //...
    />
//...
Enter fullscreen mode Exit fullscreen mode

Note that the singleDollarTextMath: false in above is force the syntax only use double dollar as the delimiter. So

$$ This equation will be rendered $$
$ This equation will NOT be rendered $

If we don't set this (like the first PR PR349 does), we will have conflict with coding in some situation, a good example is sending message related to bash scripts that has $ for the variables:

conflict2

conflict1

After adding singleDollarTextMath: false, this kind of issue will be resolved.

That's it, thanks for reading!

Top comments (0)