How to add mathematical formulas and flowcharts in the Anqi CMS editing interface and ensure correct display?

Calendar 👁️ 63

As an experienced website operations expert, I know that it is crucial to present technical information efficiently and beautifully in the increasingly professional content creation.Continuous optimization of AnQiCMS (AnQiCMS) in content management, especially in supporting Markdown editors, has brought us great convenience.Today, let's delve into how to add mathematical formulas and flowcharts to your article content in the Anqi CMS editing interface, ensuring they are displayed correctly.


Elegantly insert mathematical formulas and flowcharts in AnQi CMS: from editing to perfect presentation

In the age of information explosion, high-quality content is the core to attract and retain users.For websites involving the fields of science, technology, engineering, or mathematics (STEM), the ability to clearly and intuitively present complex mathematical formulas and technical flowcharts not only enhances the professionalism of the content but also greatly improves the reader's understanding experience.AnQi CMS knows this need, by introducing a Markdown editor and flexible template mechanism, it provides us with an efficient way to achieve this goal.

I. Prologue of content creation: Enable Markdown editing function

First, to enable your anqi CMS to support the editing of mathematical formulas and flowcharts, the first step and the most critical step is to enable the system's Markdown editor.Traditional rich text editors often struggle with complex code or specific markup, while Markdown, with its concise and structured syntax, has become the ideal choice for technical content creators.

You need to log in to the AnQi CMS backend and navigate toGlobal Settingsand then findContent settings. On this page, you will see an option toEnable Markdown editorMake sure this option is checked and the settings are saved. Once enabled, when creating or editing articles, the article content editing area will switch to Markdown mode, laying the groundwork for the insertion of formulas and flowcharts later on.

II. The magic of the editing interface: insert mathematical formulas and flowcharts

The strength of Markdown editors lies in their ability to directly embed various specific syntaxes, including LaTeX syntax for mathematical formulas and Mermaid syntax for flowcharts.

Add mathematical formula

Mathematical formulas usually use LaTeX syntax for writing. In Markdown, you can insert them in the following two ways:

  1. Inline FormulaIf you want to insert a short formula in a regular text line, you can use a single dollar sign$Enclose formula content. For example:$E=mc^2$It will be displayed as(E=mc^2).
  2. Block Formula: For formulas that need to be displayed independently with more complex formatting, double dollar signs can be used$$Enclose formula content. For example:
    
    $$
    \int_a^b f(x) \, dx = F(b) - F(a)
    $$
    
    This will display the formula centered and alone, usually with a larger font size and better readability.

In the AnQi CMS Markdown editor, you just need to enter these LaTeX syntax directly.The editor will recognize these tags, but to render them correctly as readable mathematical expressions on the front-end page, further configuration is required.

Draw a flowchart

The drawing of flowcharts, we usually use Mermaid syntax.Mermaid allows you to create various diagrams through simple text descriptions, including flowcharts, sequence diagrams, Gantt charts, and so on.In Markdown, Mermaid diagrams need to be placed within a special code block, usually withmermaidAs a language identifier.

Here is a simple Mermaid flowchart example:

graph TD;
    A[Start] --> B{Select Operation};
    B -- Yes --> C[Perform Operation];
    C --> D[End];
    B -- No --> D;

You just need to copy and paste this text into the Anqi CMS Markdown editor's code block and selectmermaidAs a language type. The editor will recognize it as a Mermaid chart.

3. Ensure perfect presentation: configuration and content rendering of template files.

Just typing these syntax in the editor is not enough to make them display on the website front end.The browser does not understand LaTeX or Mermaid directly.They need to use a JavaScript library to parse and render.This requires us to make some necessary modifications to the website template.Generally, these changes will be made in the public header or footer template files of the website (such asbase.htmlThis is the common skeleton file for Anqi CMS template.

1. Introduce the default Markdown style (optional but recommended)

Although it is not directly related to the formula and flowchart, for the overall reading experience of the content, you may consider introducing a set of beautiful Markdown rendering styles. For examplegithub-markdown-css. In yourbase.htmlthe file<head>tag, add the following.<link>Tags:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.2.0/github-markdown.min.css" crossorigin="anonymous" referrerpolicy="no-referrer" />

2. Enable math formula display: Integrated MathJax

MathJax is one of the most popular Web mathematical formula rendering engines. It can parse LaTeX syntax and render high-quality mathematical expressions. Also inbase.htmlthe file<head>tag, add the following.<script>Tags:

<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>

asyncThe attribute can ensure that the script loads in the background without blocking page rendering, improving user experience.

3. Enable flowchart display: Integrated with Mermaid

Mermaid charts also need a JavaScript library to convert their text descriptions into visual graphics. Inbase.htmlthe file</body>the tag before(or<head>Inside, but considering performance, it is recommended to add the following at the bottom of the page)<script>code block:

<script type="module">
    import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
    mermaid.initialize({ startOnLoad: true });
</script>

Heretype="module"Indicates that this is an ES module script, butmermaid.initialize({ startOnLoad: true });Tell Mermaid to automatically find and render charts after the page is loaded.

4. Ensure correct rendering of content: userenderandsafeFilter

After configuring the front-end library, there is still a key step to correctly render the article content in your template file. The article content field of Anqi CMS is usuallyContent) In Markdown mode, it stores Markdown formatted text.In order for these Markdown texts, including formulas and flowcharts, to be correctly parsed and rendered by the browser, you need to use specific filters when calling the content.

In the template for displaying article details (for examplearchive/detail.htmlor a custom article detail template), when you retrieve the article content through thearchiveDetailtag, be sure to handleContentField applicationrenderand `safe

Related articles

Can the settings of the 'Category Template' be applied to all subcategories when editing, to achieve template inheritance?

## Unveiling the Secret Weapon of AnQi CMS Category Template Inheritance: Efficient Management of Subcategory Content In the daily operation of a website, the flexibility and efficiency of a Content Management System (CMS) are crucial, especially when a website has a large and complex category structure.AnQiCMS (AnQiCMS) is an enterprise-level content management system developed based on the Go language, and its capabilities in content publishing, management, and optimization are highly praised by users.

2025-11-06

The AnQi CMS document content editor, does it support direct insertion of content from the material library to improve editing efficiency?

## AnQi CMS Content Editor: Directly insert the material library, unleash the efficiency of content productionRepetitively uploading images, manually entering repetitive text, checking fixed format content, these trivial yet time-consuming tasks often slow down the rhythm of content publication.Therefore, when talking about whether the content editor supports direct insertion of content from the material library to improve efficiency, this undoubtedly touches on the pain points of operation work.

2025-11-06

How to obtain and display the data of newly added custom fields in the Anqi CMS content model when creating a template?

As an experienced website operation expert, I fully understand the importance of a flexible content management system for efficient operation.AnQiCMS (AnQiCMS) has laid a solid foundation for us to meet the diverse needs of content display with its powerful custom content model function.However, it is not enough to define these fields only in the background. How to accurately and elegantly present these carefully set custom data on the website front-end is the core challenge in template creation.

2025-11-06

How to set up category Banner image and thumbnail in AnQi CMS and apply it to the front-end display?

As an experienced website operation expert, I am happy to give you a detailed explanation of the settings and front-end display applications of the classification banner image and thumbnail image in AnQi CMS.Today, with an increasing emphasis on visual experience, equipping a website's category page with eye-catching banners and concise thumbnails is undoubtedly a key step in enhancing user experience and optimizing page layout.A safe CMS deeply understands this, providing intuitive and powerful functions to easily achieve this goal.

2025-11-06

When customizing the content model fields, how will the 'required' option affect the content publishing process and user experience?

AnQi CMS is an efficient and customizable content management system, one of its core advantages is the flexible design of the content model.It allows us to create and manage diverse content structures according to different business scenarios, whether it is articles, products, or event information, we can find the most suitable display method.When customizing these content models, we often encounter a seemingly simple yet meaningful option - whether it is required.This small checkbox actually has a significant impact on the content publishing process and the ultimate user experience.

2025-11-06

How to set a custom URL when editing a page or category, and ensure its uniqueness across the entire site?

As an experienced website operations expert, I fully understand that how to flexibly and effectively manage URL structure in a content management system is crucial for the SEO performance and user experience of a website.AnQiCMS (AnQiCMS) provides powerful and comprehensive features in this aspect, allowing you to easily customize the URLs of pages and categories, and ensure their uniqueness throughout the entire site.Next, I will focus on how to set a custom URL when editing a page or category, and ensure its uniqueness across the entire site.This core topic, a detailed interpretation of AnQiCMS's URL customization strategy

2025-11-06

How does AnQi CMS handle the uploading of remote images on the editing interface? Does it support automatic downloading to the local?

As an experienced website operation expert, I am well aware of the core position of image content in website construction.They not only beautify the page and enhance the user experience, but are also indispensable elements for conveying information and attracting traffic.However, image management, especially dealing with remote images introduced from external websites, is often a headache for operators.Today, let's delve deeply into how AnQiCMS (AnQiCMS) efficiently and intelligently solves this challenge.

2025-11-06

How does AnQi CMS handle these links when the document content includes external links, such as automatically adding them

As an experienced website operation expert, I fully understand that external link management is crucial for the website's search engine optimization (SEO) and user experience.A high-efficiency content management system (CMS) should not only facilitate content publishing but also provide intelligent solutions in these details.AnQiCMS (AnQiCMS) performs well in this aspect, it provides a flexible and intelligent strategy for handling external links in document content, helping operators to maintain good SEO performance while ensuring content quality.### Smart Control Link

2025-11-06