In AnQi CMS, the addition of the Markdown editor undoubtedly brings great convenience to content creation, especially for users who need to write technical documents, academic papers, or complex instructions, the ability to directly insert mathematical formulas (MathJax) and flowcharts (Mermaid) is an additional feature that makes it even more beautiful.However, whether additional CDN resources are needed to support the display of these advanced Markdown elements is a consideration many users will have before using them.

From practical experience, AnQi CMS indeed allows you to write MathJax and Mermaid syntax in Markdown content.The system itself will store your Markdown original text faithfully when saving these contents.But, in order for these formulas and charts to be correctly parsed and rendered into beautiful visual effects by the browser when the user visits your website, it is necessary to rely on third-party JavaScript libraries.These libraries are not natively supported by the browser, nor are they built-in runtime rendering engines of Anqi CMS.

In simple terms, when you enter a complex mathematical formula in the Markdown editor on the Anqi CMS backend, such as$$ \int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2} $$Or an example Mermaid flowchart block, such asmermaid graph TD; A-->B; B-->C;It will store it as plain text in the database.When the user accesses the page containing this content through a browser, the browser still receives the original Markdown text.At this time, if the page does not load the corresponding JavaScript library to "translate" and "draw" these special syntaxes, then the user will only see the original Markdown code, not the rendered formulas or charts.

This is where CDN resources come into play. MathJax and Mermaid are mature open-source JavaScript libraries that need to be loaded into the user's browser to perform rendering tasks.To ensure that these libraries can be quickly and stably loaded by users worldwide, it is highly recommended to introduce the service of content delivery network (CDN).CDN deploys resources to server nodes around the world, allowing users to obtain the required files from the nearest server, greatly speeding up the loading speed and improving the stability and user experience of the website.

AnQi CMS is very flexible, it does not force捆绑a specific MathJax or Mermaid library version, but provides users with guidance on integrating external CDNs. This means that you only need to include the common template file of the website (usuallybase.html)的<head>or<body>Within the tag, add a few lines of code as provided in the official documentation to include the MathJax and Mermaid libraries.<script>or<link>Labels can be used. These labels will point to the corresponding library files hosted on CDNs, such as resources from well-known CDN service providers like jsDelivr or Cloudflare.In this way, your website can tell the user's browser where to download the necessary rendering scripts.

Enable Markdown editor after, in order for these advanced features to be presented perfectly, just enable Markdown editor in the Anqie CMS background global settings, then follow the instructions, and add the corresponding CDN reference code in your template file.This is a one-time setting, after which, all Markdown content containing MathJax or Mermaid syntax will be rendered correctly.In technical terms, you can download these JavaScript library files to your own server for local hosting, but considering the advantages of CDN in terms of loading speed, bandwidth optimization, and global access, using CDN is undoubtedly the better choice, which can significantly enhance the professionalism and user satisfaction of your website.

Frequently Asked Questions (FAQ)

1. What impact will there be if I do not add MathJax and Mermaid CDN references in the template?If your website content includes MathJax or Mermaid syntax but you have not referenced the corresponding CDN resources in the template, then users will not be able to see the rendered mathematical formulas or flowcharts when they visit these pages.They will only see the original Markdown syntax text, which will severely affect the reading experience and professionalism of the content.

2. Can I download the MathJax and Mermaid library files to host them on my local server?Yes, technically, you can download the JavaScript and CSS files of MathJax and Mermaid to your local security CMS server and refer to them in the template via a relative path.This approach is feasible in certain specific scenarios (such as strict restrictions on access to external resources, or the pursuit of the ultimate autonomy).Please note that local hosting may not enjoy the benefits of CDN such as global acceleration, high availability, and bandwidth optimization, which may lead to slower loading speeds for users in different regions or affect performance when server load is high.For most websites, using a CDN is a simpler and more efficient solution.

3. Is the operation of adding CDN references to MathJax and Mermaid in AnQi CMS complex?It's not complicated. Anqi CMS provides clear guidance for this.You just need to enable the Markdown editor in the background "Global Settings" and then find your website template file (usuallybase.html),which are a few lines provided in the official document of CDN<script>or<link>Copy the tag code and paste it into the template file<head>or<body>You can do it before the end tag. It is a very simple copy and paste operation, no programming knowledge is required.