Lưu đồ hoạt động
typescript
1graph TB;2 A[Bắt đầu] --> |kết nối| B{Điều kiện còn <br />đúng không?}3 B --> |"Đúng (True ©)"| C[Thực thi các lệnh <br />trong khối IF]4 B:::style1 --> |"Sai (No)"| D[Thực thi các lệnh <br /> trong khối ELSE]5 C --> KT[Kết thúc]6 D --> KT7 8 style A fill:#f9f,stroke:#333,stroke-width:4px9 style D fill:#bbf,stroke:#f66,stroke-width:2px,color:#000,stroke-dasharray: 5 510 classDef style1 fill:#0000ff,stroke:#333,stroke-width:4px;Sơ đồ thứ 2:
typescript
1graph TD;2 Start["Bắt đầu"] --> A["Lấy giá trị số A<br />var a = 5;"]3 A --> |"Kiểm tra giá trị số A<br />A có chia hết cho 2 hay không?"| B{"A % 2 == 0 ?"}4 B --> |"TRUE<br/>Chia hết"| Yes["IF<br />In ra màn hình a là số chẵn"]5 B --> |"FALSE<br/>Không Chia hết"| No["ELSE<br/>In ra màn hình a là số lẻ"]6 Yes --> End["Kết thúc"]7 No --> End8 9 subgraph "kiểm tra"10 A11 B12 Yes13 No14 endCode tương ứng:
php
1<script type="text/javascript" src="{{ asset('vendors/mermaid/mermaid.min.js') }}"></script>2 3<script id="wp-mermaid">4 (function($) {5 $(function() {6 debugger;7 if (typeof mermaid !== "undefined") {8 // let block_count = $(".mermaid").length;9 let block_count = $(".MermaidJSRAW").length;10 let i = 0;11 12 if (block_count > 0) {13 // $(".mermaid").each(function() {14 // let mermaid_content = $(this).html();15 // mermaid_content.replace(/<[^>]*>?/gm, "");16 // let mermaid_content_decode = $("<textarea/>")17 // .html(mermaid_content)18 // .text();19 // $(this).html(mermaid_content_decode);20 // i++;21 // });22 23 $(".MermaidJSRAW").each(function() {24 debugger;25 $(this).replaceWith(function(){26 return $('<div class="mermaid" />').append($(this).contents());27 }); 28 });29 }30 31 if (block_count === i) {32 debugger;33 // mermaid.init();34 mermaid.initialize({35 theme: 'default',36 // themeCSS: '.node rect { fill: red; }',37 logLevel: 3,38 securityLevel: 'loose',39 flowchart: {40 curve: 'basis'41 },42 gantt: {43 axisFormat: '%m/%d/%Y'44 },45 sequence: {46 actorMargin: 5047 },48 // sequenceDiagram: { actorMargin: 300 } // deprecated49 });50 }51 }52 });53 })(jQuery);54</script>css
1/* --- Custom EnligherJS Start ---------*/2/* ol.EnlighterJS li, ul.EnlighterJS li {3 border: 3px solid red !important;4}5 6ol.atomicEnlighterJS li, ul.atomicEnlighterJS li {7 border: 3px solid red !important;8} */9 10.specialline {11 border-left: 3px solid red !important;12}13/* --- Custom EnligherJS End ---------*/14 15/*=========================================================================================16 File Name: customizer-left.scss17 Description: CSS used for demo purpose only. Remove this css from your project.18 ----------------------------------------------------------------------------------------19 Item name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template20 Author: PIXINVENT21 Author URL: http://www.themeforest.net/user/pixinvent22==========================================================================================*/23 24body.dark-layout .customizer-left {25 background-color: #262c49;26}27 28.customizer-left {29 width: 400px;30 left: -400px;31 padding: 0;32 background-color: #fff;33 z-index: 1051;34 position: fixed;35 top: 0;36 bottom: 0;37 height: 100vh;38 height: calc(var(--vh, 1vh) * 100);39 transition: left 0.4s cubic-bezier(0.05, 0.74, 0.2, 0.99);40 -webkit-backface-visibility: hidden;41 backface-visibility: hidden;42 border-left: 1px solid rgba(0, 0, 0, 0.05);43 box-shadow: 0 15px 30px 0 rgba(0, 0, 0, 0.11), 0 5px 15px 0 rgba(0, 0, 0, 0.08);44}45 46.customizer-left.open {47 left: 0;48}49 50.customizer-left .customizer-left-content {51 position: relative;52 height: 100%;53}54 55.customizer-left .customizer-left-close {56 position: absolute;57 right: 30px;58 top: 20px;59 padding: 7px;60 width: auto;61 z-index: 10;62 color: #626262;63}64 65.customizer-left .customizer-left-close i {66 font-size: 1.71rem;67}68 69.customizer-left .customizer-left-toggle {70 background: #7367f0;71 color: #fff;72 display: block;73 box-shadow: -3px 0px 8px rgba(0, 0, 0, 0.1);74 border-top-right-radius: 6px;75 border-bottom-right-radius: 6px;76 position: absolute;77 top: 50%;78 width: 38px;79 height: 80px;80 right: -39px;81 text-align: center;82 /* line-height: 40px; */83 cursor: pointer;84}85 86.customizer-left .customizer-left-toggle:hover {87 color: #fff;88}89 90.customizer-left .color-box {91 height: 35px;92 width: 35px;93 margin: 0.5rem;94 border-radius: 0.5rem;95 cursor: pointer;96}97 98.customizer-left .color-box.selected {99 box-shadow: 0 0 0 3px rgba(52, 144, 220, 0.5);100}101 102.course-curriculum-customizer-left {103 height: 100%;104 overflow: auto;105}106 107/*==========================================================================================*/108 109/* --- Custom Mermaid JS START ---- */110.mermaid {111 text-align: center !important;112}113 114.dark-layout .mermaid {115 background: #fff;116}117/* --- Custom Mermaid JS END ---- */Lưu đồ Switch Case
typescript
1stateDiagram2[*] --> SWITCH3SWITCH --> CASE_14SWITCH --> CASE_25SWITCH --> CASE_DEFAULT6CASE_1 --> a17CASE_2 --> a28CASE_DEFAULT --> a39a1 --> [*]10a2 --> [*]11a3 --> [*]
