How to enable the built-in Markdown editor in AnQi CMS?

Calendar 👁️ 46

As an experienced CMS website operation person in the security field, I am well aware of the importance of content creation efficiency and presentation effect for attracting and retaining users.AnQi CMS has integrated Markdown editor in its new version, which undoubtedly brings great convenience to content creators, making content writing more efficient and structured.Below, I will give a detailed introduction on how to enable and optimize the built-in Markdown editor in AnQi CMS to fully exert its advantages in content management.

Enable the built-in Markdown editor in AnqiCMS

The AnQi CMS Markdown editor allows you to write content using concise markup syntax, thus focusing on the content itself rather than complex formatting. To enable this feature, you need to perform a simple backend setting:

First, please log in to your Anqi CMS backend management interface. Next, navigate to the "Background Settings" area in the left menu bar and click on "Content Settings". In the content settings page, you will find an option named "Enable Markdown editor".Please enable this option.

After completing the above steps, when you create or edit documents, single-page content, etc., the content editing area of Anqi CMS will automatically switch to Markdown editor mode.You can use Markdown syntax to create content in this mode.

Ensure Markdown style is displayed correctly on the front-end web page

It is not enough to enable Markdown editor only in the background, in order to present the content written in Markdown with a beautiful and standardized layout on the front-end web page, we need to introduce the corresponding CSS style files. The official document of Anqi CMS recommends usinggithub-markdown-cssThis is a widely used Markdown rendering style library on GitHub, which can provide a good reading experience.

You need to include this stylesheet in the website template (usually in the public header file, such asbase.html). The specific operation is to include it in the HTML document's<head>Add the following code inside the tag:

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

By introducing this CDN resource, your frontend page can recognize and render the content generated by Markdown syntax, making it display uniformly and professionally.

Enhance Markdown features: Support mathematical formulas and flowcharts

For professional content that requires displaying complex mathematical formulas or drawing flowcharts, Markdown itself provides syntax support, but its visual presentation on the web requires the assistance of third-party JavaScript libraries.AnQi CMS allows you to extend the functionality of the Markdown editor by integrating these libraries in the template.

Correct display of mathematical formulas:To make the web page display Markdown-written mathematical formulas (such as LaTeX syntax) correctly, you can introduce the MathJax library. Similarly, in yourbase.htmlthe file<head>Add the following code inside the tag:

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

MathJax is responsible for parsing mathematical formulas on the page and rendering them in a clear and readable format.

The correct display of flowcharts:If you need to draw flowcharts, sequence diagrams, etc., Mermaid is a very practical JavaScript library. To support the rendering of Mermaid flowcharts in the AntQi CMS front-end page, pleasebase.htmlthe file<head>Enter the code inside the tag:

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

This will import the Mermaid library and initialize its rendering function, so that the Mermaid chart code written in Markdown can be correctly parsed and displayed.

Content rendering and template precautions

After the Markdown editor is enabled, the Anqi CMS is handlingarchiveDetailandpageDetailobtained in the tagsContentWhen a field is processed, it will automatically convert Markdown content to HTML format. This means you can directly output it in the template.{{archive.Content|safe}}The content will be rendered as HTML when it is processed.

If you have specific requirements and do not want the system to automatically convert Markdown to HTML, or if you want to manually control the rendering process, you can add it in the template tags.renderParameters. For example:

  • {% archiveDetail archiveContent with name="Content" render=false %}{{archiveContent|safe}}This will prevent the system from automatically rendering Markdown, and the content will be output as raw Markdown text.
  • {% archiveDetail archiveContent with name="Content" render=true %}{{archiveContent|safe}}:Even in some cases where Markdown rendering is disabled by default, this setting can enforce rendering.

In most cases, after enabling the background Markdown editor and configuring the frontend styles and scripts, you do not need to perform any additional operationsrenderParameters, the system will automatically provide the expected rendering effect.

By following these steps, you can not only efficiently use Markdown for content creation on the Anqi CMS backend, but also ensure that these contents are presented professionally and functionally complete on the frontend page, including beautiful formatting, mathematical formulas, and flowcharts, greatly enhancing the readability and expressiveness of the content.


Frequently Asked Questions (FAQ)

Q1: I have enabled the Markdown editor in the background, why is the content displayed on the front-end page still the original Markdown text without any style?

A1: This is usually because you have not included the Markdown style library in your front-end template file. Please check yourbase.htmlor other public template files to ensure that they are included<head>Added inside thegithub-markdown-cssCDN link, such ashttps://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.2.0/github-markdown.min.css. This style file is the basis for good formatting of Markdown text on the front end.

Q2: I have written mathematical formulas or flowchart code in Markdown content, but they are displayed incorrectly on the front-end page, or they are displayed as code directly. How can I solve this?

A2: Markdown itself only provides syntax identification, the actual rendering of mathematical formulas (such as LaTeX) and flowcharts (such as Mermaid) depends on specific JavaScript libraries. Make sure you have alreadybase.htmlthe file<head>The CDN script for MathJax (used for mathematical formulas) and Mermaid (used for flowcharts) was correctly introduced in the tag, and the Mermaid script was also initialized.If the import is error-free, please check for any error messages in the browser console, which may help locate the problem.

Q3: How do I prevent the content of a specific document from being rendered in Markdown, even though the Markdown editor is enabled globally?

A3: You can manually control the rendering behavior of content fields in the template. When callingContentfield'sarchiveDetailorpageDetailthe tag, you can addrender=falseParameters. For example:{% archiveDetail articleContent with name="Content" render=false %}{{articleContent|safe}}This will output the content of the specific document in its original Markdown text format, and will not be converted to HTML.

Related articles

How to implement string processing and content-safe output for AnqiCMS filters (such as `safe`, `truncatechars`)?

As an experienced CMS website operation personnel for an enterprise, I know the importance of content quality and safe output for the success of the website.In daily content management, we often need to format text to ensure its beauty and readability on the front-end interface.At the same time, the secure output of content is the cornerstone that we cannot ignore, as it is directly related to user experience, website reputation, and even legal compliance.The AnQi CMS provides a powerful and flexible template filter mechanism to help us easily cope with these challenges.

2025-11-06

How to flexibly use the `if`, `for` and other logical judgment and loop tags in AnqiCMS template development?

As a professional deeply familiar with AnqiCMS operations, I know that template development is the core link in building a website with attractive appearance and complete functions.During the process of content creation, editing, and publishing, flexibly using logical judgments and loop tags in template languages can make our website content dynamically presented and adaptable to diverse business scenarios, thereby better meeting the needs of readers and improving user experience.Today, let's delve into the flexible application of logical tags such as `if`, `for`, and others in AnqiCMS template development.

2025-11-06

How to use the pagination tag in the AnqiCMS template to implement pagination display of document lists?

As an experienced CMS website operation personnel of an information security company, I fully understand that how to effectively display content is the key to attracting and retaining users when building and maintaining a website.Especially for pages such as document lists that may contain a large amount of information, a reasonable pagination mechanism not only improves user experience but also optimizes website performance.Today, I will elaborate on how to use the pagination tag in AnqiCMS templates to implement pagination of document lists.

2025-11-06

The AnqiCMS comment management feature, does it support liking and replying operations?

As an experienced security CMS website operation person, I know that content is the soul of the website, and user interaction is an important manifestation of the vitality of the content.AnQi CMS provides rich and powerful features in content management, among which comment management is a key link to build the community and enhance user stickiness.Today, I will elaborate on the comment management function of Anqi CMS to discuss whether it supports like and reply operations.

2025-11-06

Where can I find the Markdown editor settings option for Anq CMS?

As an experienced CMS website operation personnel of AnQi, I am very clear about the importance of efficient content management for the success of the website.The functions provided by Anqi CMS are designed to simplify this process, among which the Markdown editor is a powerful tool for content creators.Many users may be curious, how can this editor be enabled and configured?Now, let me give you a detailed explanation.

2025-11-06

How to write article content using Markdown syntax after enabling the Markdown editor?

As an experienced CMS website operation personnel in the security industry, I know that efficient content creation and publishing is crucial for attracting and retaining users.The newly added Markdown editor in AnQi CMS is the powerful tool that helps us improve work efficiency and optimize content presentation.It allows content creators to focus on the text itself, while entrusting the layout work to the system, ultimately presenting content that is clear in structure, beautiful, and generous.

2025-11-06

Which basic Markdown syntax elements and features does AnQi CMS support?

As an expert in the operation of Anqi CMS, I fully understand the importance of content creation efficiency and presentation quality to user experience.The advantages of AnQi CMS in content management are largely due to its good support for Markdown syntax, which brings us great convenience and flexibility.Our Aiqi CMS deeply integrates Markdown editors, dedicated to providing content creators with an efficient, flexible, and feature-rich writing environment.This integration allows us to quickly build structured content with a concise markup language

2025-11-06

How can you correctly display the style of Markdown content on the AnQi CMS webpage?

As a senior AnQi CMS website operation personnel, I am well aware that the presentation of high-quality content is crucial for attracting and retaining users.Markdown is a lightweight markup language that is favored by content creators for its concise and efficient features.AnQi CMS provides support for Markdown content, but it is necessary to ensure that it is displayed correctly and beautifully on the web page, and some template configuration is required.

2025-11-06