How to enable Markdown rendering and correctly display mathematical formulas and flowcharts in AnQiCMS?

Calendar 👁️ 80

In AnQiCMS, to make your content more expressive, especially when you need to display complex mathematical formulas or clear flowcharts, it is a very effective solution to flexibly use the Markdown editor.The new version of AnQiCMS has provided good support for this.Next, we will explore how to enable these features in AnQiCMS, making your website content come alive.


Step 1: Enable Markdown Editor

To start using Markdown to write content, we first need to enable it in the AnQiCMS backend settings. It's very simple, just a few clicks to complete.

Please log in to your AnQiCMS backend, navigate to 'Global Settings', and then select 'Content Settings'.On this page, you will find an option called 'Markdown Editor'.Please set its status to "Enabled" and save your changes.

After completing this step, when you create or edit articles, product details, or single-page content in the background, the original rich text editor interface will be replaced by the Markdown editor.This means you can directly use Markdown syntax for content creation, which greatly improves editing efficiency and the structuring of content.

Step two: Apply a beautiful default style to Markdown content

Although Markdown editors make content creation convenient, the Markdown syntax itself only defines the structure of the content, but not their display styles.To make your Markdown content look professional and beautiful on the front-end page, we need to introduce a set of universal Markdown rendering styles.

We recommend usinggithub-markdown-cssThis is a widely popular GitHub style Markdown style. You can easily integrate it into your website via CDN.

Please find your website template file, usually in/templatethe directory, wherebase.htmlthe file is the basic skeleton shared by all pages of your website. Openbase.htmlthe file, and<head>at the end of the tag, </head>Before, add the following line of code:

<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" />

Savebase.htmlAfter the file, your website will have the ability to render GitHub style Markdown content.After publishing Markdown articles, they will automatically apply this simple and readable style.

Step 3: Make mathematical formulas display correctly on the web

For users who need to insert mathematical formulas into articles, AnQiCMS also provides a solution.By integrating the powerful JavaScript display engine MathJax, your website can elegantly render LaTeX, MathML, or AsciiMath formatted mathematical formulas.

Similarly, you need tobase.htmlthe file<head>Inside the tag, after adding the CSS style in the previous step, insert the following script code:

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

Now, you can use LaTeX syntax to write mathematical formulas in Markdown content. For example, using$inline formulas enclosed by$E=mc^2$, or using$$Enclosed block-level formula:

$$
\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
$$

These formulas will be rendered into clear and recognizable mathematical symbols on the page by MathJax.

Step four: Draw a clear flowchart on the web.

Flowcharts are a tool for visualizing complex processes, system architecture, or decision paths.AnQiCMS integrates the Mermaid library, allowing you to directly write text in Markdown and automatically convert it into a beautifully formatted flowchart.

Please continue onbase.htmlthe file<head>Within the tag, after the MathJax script, add the following script code:

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

After configuration, you can create Mermaid flowcharts in Markdown content. Just use special Mermaid code blocks, such as:

graph TD;
    A[User] --> B(Submit form);
    B --> C{Validate data?};
    C -- Yes --> D[Process data];
    C -- No --> E(Show error);
    D --> F[Save successfully];
    F --> G[Notify user];

This simple text description will be automatically rendered into a professional flowchart on your web page.


Write and publish Markdown content

After completing all the above configurations, you can freely use the AnQiCMS backend editor.When you create or edit a document, you just need to enter Markdown syntax directly in the Markdown editor, including LaTeX code for mathematical formulas and Mermaid code for flowcharts.AnQiCMS is responsible for rendering and displaying on the front-end page, making your content professional and easy to understand.


Frequently Asked Questions (FAQ)

1. I have enabled the Markdown editor and written formulas and flowcharts in the article, but they are not displayed on the front end or the style is incorrect, what should I do?

First, make sure you follow the steps in the article on your website,base.htmland correctly import the file.github-markdown-cssCSS, as well as the JavaScript scripts for MathJax and Mermaid.Please carefully check if there are any spelling errors in the file path and code, or if the CDN link is valid.<head>Label inside. Sometimes, browser cache may also cause problems, try clearing the browser cache and then accessing the page.

2. Can I only use Markdown rendering for some articles and not all?

After enabling AnQiCMS's Markdown editor, the content you edit in it will be stored and rendered in Markdown format by default.If you need to disable or force Markdown rendering in specific situations, you can control it on the template tag of the content field.{% archiveDetail archiveContent with name="Content" render=false %}{{archiveContent|safe}}{% endarchiveDetail %}You can force the Markdown rendering to be turned off. Conversely,render=trueYou can force Markdown rendering even if the editor is not enabled globally.

3. My flowchart and mathematical formulas are displayed normally, but the overall style of Markdown still looks a bit off, different from the example image.

This is usually because your website template may come with some global CSS styles that may override or affectgithub-markdown-cssThe effect.You can try to use the browser's developer tools (usually open by pressing F12), to check the CSS rules applied to the Markdown elements.!importantBut the latter should be used with caution), or slightly modifying your template CSS, it usually resolves style conflicts and allows Markdown content to display as expected.

Related articles

How to display additional field data in the front-end template after customizing the content model?

AnQiCMS with its flexible content model function has brought great convenience to us in managing various types of website content.Whether it is an article, product, event, or any other content type that requires special fields, we can easily customize fields in the background to meet unique business needs.But when we eagerly create new fields in the background and fill them with data, new problems also arise: How can we accurately display these newly added custom field data on the front page of the website for visitors?Don't worry, AnQiCMS

2025-11-09

How to implement the function of displaying and switching content in multiple languages?

Make your website go global: Anqi CMS multilingual content strategy and implementation In today's globalized digital age, many businesses and content creators hope that their websites can reach a wider audience.This means providing content display and switching functions in multiple languages to meet the reading habits of users in different countries and regions.AnQiCMS (AnQiCMS) is an efficient content management system that fully considers this requirement, providing a flexible solution to help you easily implement the multilingual function of the website.In AnQi CMS, implement multi-language display and switching of content

2025-11-09

How to retrieve and display the SEO title and description of the current document in the template?

In website operation, Search Engine Optimization (SEO) is a key element to enhance website visibility.And the page title (Title) and description (Description) as the first information seen by search engines and users browsing, its importance is self-evident.AnQiCMS (AnQiCMS) knows this and therefore provides a flexible and powerful mechanism to retrieve and display these SEO elements in the template.### AnQi CMS's TDK (Title, Description,

2025-11-09

How to set and optimize the static URL structure of a website to enhance the display effect in search engines?

The importance of website operation and URL structure is self-evident.A clear and meaningful URL not only helps users better understand the page content, but is also a key factor in search engine optimization (SEO).Especially for content management systems, properly setting up the pseudo-static URL structure can significantly improve the display effect and user experience of the website in search engines.AnQiCMS as a content management system that focuses on SEO optimization, provides strong and flexible support in this aspect.It not only built-in a variety of commonly used pseudo-static rules

2025-11-09

How to embed a comment list on the page and control its pagination display?

In website operation, user interaction is the key to enhancing site activity and content value.AnQiCMS provides a set of intuitive and powerful features that help us easily embed comment functions in pages and flexibly control the display of comment lists, especially its pagination management, which is crucial for pages with a large number of user comments. ### Enable comment functionality to bring content to life Firstly, we need to ensure that the comment functionality is enabled on the backend so that users can post comments.Once the comment feature is activated

2025-11-09

How to loop through and display all subcategories under a specified category in a template?

How to elegantly display all subcategories under a specified category in Anqi CMS template?For a content-rich website, a clear classification structure is the key to improving user experience and search engine friendliness.AnQiCMS (AnQiCMS) takes advantage of its flexible template engine and powerful tag system, allowing you to easily traverse and display all subcategories under a specified category on the website front end, whether it is a direct subcategory or a multi-level nested subcategory, you can handle it with ease.Today, let's discuss how to implement this feature in Anqi CMS templates.

2025-11-09

How to display a second-level dropdown menu in the navigation menu and associate different content?

AnQi CMS provides a直观and powerful navigation menu management system, allowing you to easily build a clear, user-friendly navigation structure for your website, including multi-level dropdown menus.This not only improves the user experience of the website, but also helps search engines better understand the hierarchy of your website content, thus optimizing SEO performance. ### Understanding the navigation system of Anqi CMS In Anqi CMS, the settings and management of the navigation menu are concentrated in the "Website Navigation Settings" function in the background.This is the core area where you build your website menu

2025-11-09

How to specify an independent template file for content display for a specific category or single page?

In a content management system, we often need to present certain specific content of the website in a unique way, which not only meets the specific needs of branding or marketing, but also brings an optimized browsing experience for visitors.Our CMS is well-versed in this, providing flexible template customization features, allowing us to easily specify a unique template file for a category page, or even a single content page.Why do you need to customize the template for a specific page?

2025-11-09