When publishing Markdown documents in AnQi CMS, content creators often need to embed complex elements such as mathematical formulas and flowcharts to express information more clearly and accurately.AnQi CMS knows that high-quality content is important for attracting and retaining users, so the new system has enhanced support for these advanced content formats.To ensure that these elements can be correctly parsed and perfectly presented, we need to make some necessary configurations.

Enable Markdown editor

Before starting to create a Markdown document containing mathematical formulas and flowcharts, the primary task is to activate the Markdown editor in the Anqi CMS backend.This step is the foundation for enabling advanced Markdown features.You need to navigate to "AnQi CMS backend -> Global Settings -> Content Settings", then find and enable the Markdown editor option.After enabling, content creators will be able to write content using Markdown syntax, including special tags for formulas and charts.

Apply Markdown default style

Although Markdown can provide structure to content, a unified and beautiful visual presentation is crucial for user experience.To ensure consistent clarity and readability of your Markdown rendering across various browsers, we recommend applying a standard Markdown stylesheet.The Anqi CMS template system has sufficient flexibility, allowing you to easily integrate external styles.base.htmltemplate file<head>Partially add a pointer togithub-markdown-cssAnd well-known CSS libraries of<link>Label. This will automatically format standard Markdown elements such as headings, lists, and paragraphs, thereby providing a professional and unified visual effect.

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

Ensure the correct display of mathematical formulas

To elegantly present complex mathematical equations on a webpage, a professional rendering engine is needed.AnQi CMS integrates MathJax to achieve this, MathJax is a powerful JavaScript math display engine that is compatible with all major browsers.<script>Add a label to yourbase.htmlthe file<head>Part.MathJax automatically scans your Markdown content, identifies mathematical expressions written in LaTeX or AsciiMath syntax, and renders them as high-quality, scalable graphics.$$E=mc^2$$To create a block-level formula, or use$a^2 + b^2 = c^2$To insert an inline formula.

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

Ensure the correct display of flowcharts

Visualization of business processes and their relationships through flowcharts can greatly enhance the clarity of content.AnQi CMS supports Mermaid.js, which is a chart tool based on JavaScript that can convert text-defined flowcharts into interactive SVG charts.base.htmlIn the template. It is recommended to place the following code snippet in<body>at the end of the section or<head>and add it to the section.deferProperty, to ensure that Mermaid initializes correctly after the page content is fully loaded. In Markdown documents, you can use special code blocks (usually marked asmermaid...Define your flowchart.

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

Creative practice in Markdown documents.

Before yourbase.htmlAfter completing the integration of the above script in the template, content creators can directly write mathematical formulas and process flow definitions in the Markdown editor. For mathematical formulas, please use standard LaTeX syntax and enclose them with appropriate delimiters (such as,$$...$$Used for block-level formulas,$ ... $Used for inline formulas). For flowcharts, please use a special Mermaid code block (such asmermaid...Using Mermaid's concise text syntax to define inside.The AnQi CMS Markdown processor will pass these definitions to the corresponding JavaScript library for rendering, ultimately presenting high-quality formulas and charts on the frontend page.

**Practice and Problem Diagnosis

When integrating these external resources, be sure to ensure yourbase.htmlThe file accurately includes all scripts and link tags.Any spelling errors or incorrect placement may cause rendering failure.If the mathematical formula or flow chart does not display correctly, please first confirm that the Markdown editor is enabled.base.htmlIs there any error in the code snippet added to the template.At the same time, confirm that the syntax of the mathematical formulas (LaTeX) and flowcharts (Mermaid.js) used in your Markdown content meets the requirements of its official documentation.The console of the browser developer tools usually displays JavaScript errors, which often help you quickly locate and solve rendering issues.

Frequently Asked Questions

Q1: Why did I enable the Markdown editor and add all the required scripts, but the mathematical formulas and flowcharts still do not display?

A:First, please carefully check what you havebase.htmladded to the file<script>and<link>whether the tags are complete and correct. Especially confirmsrcWhether the CDN resource pointed to by the attribute (such as MathJax, Mermaid.js, and github-markdown-css) can be accessed normally.$$...$$used for mathematical formulas ormermaid...enclosed in flow charts.

Q2: Can I download these external CDN resources to my local server instead of relying on third-party CDNs?

A:Yes, it can be absolutely.github-markdown-cssThe file has been downloaded to your AnQiCMS server. After downloading, you need to modify accordinglybase.htmlin the templatesrcandhrefProperties, make it point to the file path in your local storage.However, please note that this means you will need to take responsibility for updating and maintaining these library files to ensure that your website always uses the latest and most secure versions.

Q3: Can I directly insert custom HTML code into the content after enabling the Markdown editor?

A:The AnQi CMS Markdown editor usually filters or treats input HTML code as plain text to prevent potential cross-site scripting (XSS) attacks and other security vulnerabilities.Although some simple HTML tags may be preserved, it is not recommended to directly insert complex HTML structures into Markdown editors.If you need to insert complex HTML content, it is recommended to use the rich text editor provided by AnQiCMS, or directly write HTML code in the website template files.For mathematical formulas and flowcharts, please strictly follow the specific syntax conventions of Markdown and its corresponding rendering library, rather than directly inserting HTML.