### Run Example App Source: https://github.com/asjqkkkk/markdown_widget/blob/main/CLAUDE.md Navigates to the example directory and runs the example application. ```bash cd example && flutter run ``` -------------------------------- ### Build Example for Web Source: https://github.com/asjqkkkk/markdown_widget/blob/main/CLAUDE.md Navigates to the example directory and builds the example app for the web. ```bash cd example && flutter build web ``` -------------------------------- ### Installing the Application Executable Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/CMakeLists.txt Installs the main application executable to the root of the installation prefix. ```cmake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Defining Installation Directories Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/CMakeLists.txt Sets variables for the installation directories for data and libraries within the bundle. ```cmake set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") ``` -------------------------------- ### Install Dependencies Source: https://github.com/asjqkkkk/markdown_widget/blob/main/CLAUDE.md Installs project dependencies using Flutter. ```bash flutter pub get ``` -------------------------------- ### Build Linux Release Source: https://github.com/asjqkkkk/markdown_widget/blob/main/CLAUDE.md Navigates to the example directory and builds a release version for Linux. ```bash cd example && flutter build linux --release ``` -------------------------------- ### Install Executable and Runtime Files Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/windows/CMakeLists.txt Configures the installation of the main executable, ICU data, Flutter library, and bundled plugin libraries to the runtime destination. ```cmake set(BUILD_BUNDLE_DIR "$") set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Build Windows Release Source: https://github.com/asjqkkkk/markdown_widget/blob/main/CLAUDE.md Navigates to the example directory and builds a release version for Windows. ```bash cd example && flutter build windows --release ``` -------------------------------- ### Build macOS Release Source: https://github.com/asjqkkkk/markdown_widget/blob/main/CLAUDE.md Navigates to the example directory and builds a release version for macOS. ```bash cd example && flutter build macos --release ``` -------------------------------- ### Setting Installation Prefix and Bundle Directory Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/CMakeLists.txt Configures the installation prefix to a bundle directory and ensures it's cleaned on each build. ```cmake set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Installing Flutter Library Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/CMakeLists.txt Installs the main Flutter library file to the library directory within the bundle. ```cmake install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Installing Bundled Plugin Libraries Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/CMakeLists.txt Installs any bundled plugin libraries to the library directory within the bundle. ```cmake foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endforeach(bundled_library) ``` -------------------------------- ### Build Android Release APK Source: https://github.com/asjqkkkk/markdown_widget/blob/main/CLAUDE.md Navigates to the example directory and builds a release APK for Android. ```bash cd example && flutter build apk --release ``` -------------------------------- ### Build Android Release App Bundle Source: https://github.com/asjqkkkk/markdown_widget/blob/main/CLAUDE.md Navigates to the example directory and builds a release App Bundle for Android. ```bash cd example && flutter build appbundle --release ``` -------------------------------- ### Font Size Examples Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Demonstrates various font size commands in LaTeX, from \Huge to \tiny. ```latex $\Huge Hello!$ $\huge Hello!$ $\LARGE Hello!$ $\Large Hello!$ $\large Hello!$ $\normalsize Hello!$ $\small Hello!$ $\scriptsize Hello!$ $\tiny Hello!$ ``` -------------------------------- ### Install Flutter Assets Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/windows/CMakeLists.txt Installs the Flutter assets directory by first removing any existing directory and then copying the new assets. This ensures assets are up-to-date. ```cmake set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Install AOT Library Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/windows/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compiled library, but only for Profile and Release build configurations. ```cmake install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Build iOS Release Source: https://github.com/asjqkkkk/markdown_widget/blob/main/CLAUDE.md Navigates to the example directory and builds a release version for iOS without codesigning. ```bash cd example && flutter build ios --release --no-codesign ``` -------------------------------- ### CMake Project Setup Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/runner/CMakeLists.txt Sets the minimum CMake version and project name for the runner application. ```cmake cmake_minimum_required(VERSION 3.13) project(runner LANGUAGES CXX) ``` -------------------------------- ### Installing ICU Data File Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/CMakeLists.txt Installs the ICU data file to the data directory within the bundle. ```cmake install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Mermaid Flowchart Example Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/mermaid.md A basic flowchart demonstrating nodes and directional links. ```mermaid graph TD A[Start] --> B{Is it working?} B -->|Yes| C[Great!] B -->|No| D[Debug] D --> B C --> E[Finish] ``` -------------------------------- ### Mermaid Git Graph Example Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/mermaid.md A git graph visualizing commits, branches, and merges. ```mermaid gitGraph commit commit branch develop checkout develop commit commit checkout main merge develop commit commit ``` -------------------------------- ### Fraction and Power Equation Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md An example of an equation involving fractional exponents and subtraction. ```latex $$f(x) = x^2 - x^\frac{1}{\pi}$$ ``` -------------------------------- ### Mermaid User Journey Example Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/mermaid.md A user journey diagram mapping out steps in a working day with time allocations. ```mermaid journey title My working day section Go to work Make tea: 5: Me Go upstairs: 3: Me Do work: 1: Me, Cat section Go home Go downstairs: 5: Me Sit down: 5: Me ``` -------------------------------- ### Mermaid Sequence Diagram Example Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/mermaid.md Illustrates a sequence diagram with participants, messages, loops, and notes. ```mermaid sequenceDiagram participant Alice participant Bob Alice->>John: Hello John, how are you? loop Healthcheck John->>John: Fight against hypochondria end Note right of John: Rational thoughts
prevail! John-->>Alice: Great! John->>Bob: How about you? Bob-->>John: Jolly good! ``` -------------------------------- ### TOC Controller Setup Source: https://github.com/asjqkkkk/markdown_widget/blob/main/README.md Implement the Table of Contents (TOC) feature using TocController. This allows for navigation within the markdown document based on headings. ```dart final tocController = TocController(); Widget buildTocWidget() => TocWidget(controller: tocController); Widget buildMarkdown() => MarkdownWidget(data: data, tocController: tocController); @override Widget build(BuildContext context) { return Scaffold( body: Row( children: [ Expanded(child: buildTocWidget()), Expanded(child: buildMarkdown(), flex: 3) ], )); } ``` -------------------------------- ### Mermaid Mindmap Example Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/mermaid.md A mindmap illustrating hierarchical relationships with text and icons. ```mermaid mindmap root((mindmap)) Origins Long history ::icon(fa fa-book) Popularisation British popular psychology author Tony Buzan Research On effectiveness
and features On Automatic creation Uses Creative techniques Strategic planning Argument mapping ``` -------------------------------- ### Install AOT Library on Non-Debug Builds Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/CMakeLists.txt Installs the AOT library to the specified destination only when the build type is not 'Debug'. Ensure the AOT_LIBRARY variable is correctly set. ```cmake if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Custom Link Styling and OnTap Source: https://github.com/asjqkkkk/markdown_widget/blob/main/README.md Customize the appearance and behavior of markdown links. This example demonstrates how to change the link's style and define an action to perform when a link is tapped. ```dart Widget buildMarkdown() => MarkdownWidget( data: data, config: MarkdownConfig(configs: [ LinkConfig( style: TextStyle( color: Colors.red, decoration: TextDecoration.underline, ), onTap: (url) { ///TODO:on tap }, ) ])); ``` -------------------------------- ### Mermaid State Diagram Example Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/mermaid.md A state diagram showing transitions between different states, including an initial and final state. ```mermaid stateDiagram-v2 [*] --> Still Still --> [*] Still --> Moving Moving --> Still Moving --> Crash Crash --> [*] ``` -------------------------------- ### Define Flutter library path Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/windows/flutter/CMakeLists.txt Sets the path to the Flutter Windows DLL. This is a published variable for the install step. ```cmake set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) ``` -------------------------------- ### Mermaid Timeline Example Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/mermaid.md A timeline charting historical events, specifically the launch years of social media platforms. ```mermaid timeline title History of Social Media Platform 2002 : LinkedIn 2004 : Facebook : Google 2005 : Youtube 2006 : Twitter ``` -------------------------------- ### Mermaid Entity Relationship Diagram Example Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/mermaid.md An ER diagram showing relationships between entities like CUSTOMER, ORDER, and LINE-ITEM. ```mermaid erDiagram CUSTOMER ||--o{ ORDER : places ORDER ||--|{ LINE-ITEM : contains CUSTOMER }|..|{ DELIVERY-ADDRESS : uses ``` -------------------------------- ### Project and Build Configuration Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/windows/CMakeLists.txt Sets up the minimum CMake version, project name, and manages build configuration types based on whether the generator is multi-config. ```cmake cmake_minimum_required(VERSION 3.14) project(example LANGUAGES CXX) set(BINARY_NAME "example") cmake_policy(SET CMP0063 NEW) get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(IS_MULTICONFIG) set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" CACHE STRING "" FORCE) else() if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Profile" "Release") endif() endif() ``` -------------------------------- ### Run Asset Conversion Script Source: https://github.com/asjqkkkk/markdown_widget/blob/main/CLAUDE.md Executes a script to convert assets for the web demo. ```bash dart run example/build_script/script_convert_asset.dart ``` -------------------------------- ### Basic Mermaid Wrapper Usage Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/mermaid_description_en.md Demonstrates how to create a Mermaid wrapper and integrate it into MarkdownWidget configuration for basic usage. ```dart final preConfig = PreConfig( wrapper: createMermaidWrapper( config: const MermaidConfig(), isDark: isDark, preConfig: preConfig, ), ); MarkdownWidget( data: markdown, config: config.copy(configs: [preConfig]), ) ``` -------------------------------- ### Run Tests Source: https://github.com/asjqkkkk/markdown_widget/blob/main/CLAUDE.md Executes the project's test suite. ```bash flutter test ``` -------------------------------- ### Matrix Multiplication (Square Brackets) Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Demonstrates matrix multiplication using the \bmatrix environment for square matrices. ```latex $$ M = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} $$ ``` -------------------------------- ### Find and Check GTK Dependencies Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/flutter/CMakeLists.txt Uses PkgConfig to find and check for required GTK libraries (gtk+-3.0, glib-2.0, gio-2.0) and imports their targets for use in the build. ```cmake find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) ``` -------------------------------- ### Configuring Runtime Library Path Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/CMakeLists.txt Sets the runtime path for libraries to be loaded from the 'lib/' directory relative to the binary. ```cmake set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") ``` -------------------------------- ### General Matrix Notation Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Presents the general notation for an m x n matrix using the \pmatrix environment. ```latex $$ A_{m,n} = \begin{pmatrix} a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\ a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m,1} & a_{m,2} & \cdots & a_{m,n} \end{pmatrix} $$ ``` -------------------------------- ### Create Flutter wrapper app library Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/windows/flutter/CMakeLists.txt Creates a STATIC library target 'flutter_wrapper_app' for the runner, applying standard settings, and linking against the 'flutter' library. ```cmake add_library(flutter_wrapper_app STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_APP} ) apply_standard_settings(flutter_wrapper_app) target_link_libraries(flutter_wrapper_app PUBLIC flutter) target_include_directories(flutter_wrapper_app PUBLIC "${WRAPPER_ROOT}/include" ) add_dependencies(flutter_wrapper_app flutter_assemble) ``` -------------------------------- ### Apply Standard Build Settings Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/runner/CMakeLists.txt Applies a standard set of build settings to the specified target. This can be customized for applications with different build requirements. ```cmake apply_standard_settings(${BINARY_NAME}) ``` -------------------------------- ### Matrix Multiplication (Parentheses) Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Illustrates matrix multiplication using the \pmatrix environment for matrices enclosed in parentheses. ```latex $$ M = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} $$ ``` -------------------------------- ### Link Libraries and Include Directories Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/windows/runner/CMakeLists.txt Adds necessary dependency libraries (flutter, flutter_wrapper_app, dwmapi.lib) and include directories to the project. Application-specific dependencies should also be added here. ```cmake # Add dependency libraries and include directories. Add any application-specific # dependencies here. target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") ``` -------------------------------- ### Run Tests with Coverage Source: https://github.com/asjqkkkk/markdown_widget/blob/main/CLAUDE.md Executes tests and generates a coverage report. ```bash flutter test --coverage ``` -------------------------------- ### Basic Mermaid Diagram Support Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/demo_en.md Integrates Mermaid diagram rendering into Markdown. Requires `createMermaidWrapper` and `MermaidConfig`. Ensure `isDark` is correctly determined for theme support. ```dart import 'package:markdown_widget/markdown_widget.dart'; import 'markdown_custom/mermaid.dart'; // Basic usage final isDark = Theme.of(context).brightness == Brightness.dark; final preConfig = PreConfig( wrapper: createMermaidWrapper( config: const MermaidConfig(), isDark: isDark, preConfig: preConfig, ), ); MarkdownWidget( data: markdown, config: config.copy(configs: [preConfig]), ) ``` -------------------------------- ### Cross-Building Sysroot Configuration Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/CMakeLists.txt Configures the sysroot and find root path modes for cross-compiling. ```cmake if(FLUTTER_TARGET_PLATFORM_SYSROOT) set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) endif() ``` -------------------------------- ### Set Notation Equation Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Demonstrates how to define a set using LaTeX, specifying elements and conditions. ```latex $$\mathbb{N} = \{ a \in \mathbb{Z} : a > 0 \}$$ ``` -------------------------------- ### Matrix with Fractions Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Shows a 3x3 matrix containing fractional elements, using the \bmatrix environment. ```latex $$ M = \begin{bmatrix} \frac{5}{6} & \frac{1}{6} & 0 \[0.3em] \frac{5}{6} & 0 & \frac{1}{6} \[0.3em] 0 & \frac{5}{6} & \frac{1}{6} \end{bmatrix} $$ ``` -------------------------------- ### Create Flutter wrapper plugin library Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/windows/flutter/CMakeLists.txt Creates a STATIC library target 'flutter_wrapper_plugin' for plugins, applying standard settings, setting position-independent code and C++ visibility, and linking against the 'flutter' library. ```cmake add_library(flutter_wrapper_plugin STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ) apply_standard_settings(flutter_wrapper_plugin) set_target_properties(flutter_wrapper_plugin PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(flutter_wrapper_plugin PROPERTIES CXX_VISIBILITY_PRESET hidden) target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) target_include_directories(flutter_wrapper_plugin PUBLIC "${WRAPPER_ROOT}/include" ) add_dependencies(flutter_wrapper_plugin flutter_assemble) ``` -------------------------------- ### Product Notation Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Illustrates the use of product notation for a series of multiplications. ```latex $$\prod_{i=1}^{n} x_i - 1$$ ``` -------------------------------- ### Code Highlighting with Custom Themes Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/demo_en.md Apply custom themes for code highlighting using PreConfig and flutter_highlight themes. ```dart import 'package:flutter_highlight/themes/a11y-light.dart'; Widget buildMarkdown() => MarkdownWidget( data: data, config: MarkdownConfig(configs: [ PreConfig(theme: a11yLightTheme), ])); ``` -------------------------------- ### Enabling Modern CMake Behaviors Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/CMakeLists.txt Opts into modern CMake behaviors to avoid warnings with recent CMake versions. ```cmake cmake_policy(SET CMP0063 NEW) ``` -------------------------------- ### Inline and Display Equations Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Use $equation$ for inline equations and $$equation$$ for display equations. ```latex Inline equation: $equation$ ``` ```latex Display equation: $$equation$$ ``` -------------------------------- ### Checking for GTK+ 3.0 Package Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/CMakeLists.txt Uses PkgConfig to find and check for the GTK+ 3.0 library, making its targets available. ```cmake find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) ``` -------------------------------- ### Create Flutter interface library Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/windows/flutter/CMakeLists.txt Creates an INTERFACE library target named 'flutter' and sets its include directories and link libraries. ```cmake add_library(flutter INTERFACE) target_include_directories(flutter INTERFACE "${EPHEMERAL_DIR}" ) target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") add_dependencies(flutter flutter_assemble) ``` -------------------------------- ### Apply Standard Compilation Settings Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/windows/CMakeLists.txt A function to apply common compilation features, options, and definitions to a target, ensuring consistent build settings. ```cmake function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_17) target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") target_compile_options(${TARGET} PRIVATE /EHsc) target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") endfunction() ``` -------------------------------- ### Logarithm Equation Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Displays a basic logarithm equation. ```latex $$\log_a b = 1$$ ``` -------------------------------- ### Including Generated Plugin Rules Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/CMakeLists.txt Includes the CMake script that manages the building and integration of generated plugins. ```cmake include(flutter/generated_plugins.cmake) ``` -------------------------------- ### Link Application Libraries Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/runner/CMakeLists.txt Links the necessary libraries (flutter and GTK) to the runner executable. GTK is linked using PkgConfig for proper integration. ```cmake target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) ``` -------------------------------- ### Setting Runtime Output Directory Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/CMakeLists.txt Configures the executable to be placed in a subdirectory within the build directory to prevent direct execution of unbundled copies. ```cmake set_target_properties(${BINARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" ) ``` -------------------------------- ### Project and Minimum CMake Version Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/CMakeLists.txt Sets the minimum required CMake version and the project name with supported languages. ```cmake cmake_minimum_required(VERSION 3.10) project(runner LANGUAGES CXX) ``` -------------------------------- ### Profile Build Mode Settings Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/windows/CMakeLists.txt Defines linker and compiler flags for the Profile build mode, typically inheriting from Release settings. ```cmake set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") ``` -------------------------------- ### Include generated configuration Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/windows/flutter/CMakeLists.txt Includes the generated_config.cmake file from the ephemeral directory, which provides configuration details from the Flutter tool. ```cmake include(${EPHEMERAL_DIR}/generated_config.cmake) ``` -------------------------------- ### Custom Mermaid Configuration Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/mermaid_description_en.md Shows how to customize Mermaid rendering behavior using MermaidConfig, including display mode, background color, padding, and custom widgets. ```dart MermaidConfig( displayMode: MermaidDisplayMode.codeAndDiagram, diagramBackgroundColor: Colors.grey.withValues(alpha: 0.1), diagramPadding: EdgeInsets.all(16.0), showLoadingIndicator: true, loadingWidget: CustomLoadingWidget(), stateBuilder: (state) => CustomStateWidget(state), ) ``` -------------------------------- ### Define C++ wrapper sources Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/windows/flutter/CMakeLists.txt Defines lists for C++ wrapper source files, categorized into core, plugin, and application components, and prepends the wrapper root directory path to each. ```cmake list(APPEND CPP_WRAPPER_SOURCES_CORE "core_implementations.cc" "standard_codec.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") list(APPEND CPP_WRAPPER_SOURCES_PLUGIN "plugin_registrar.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") list(APPEND CPP_WRAPPER_SOURCES_APP "flutter_engine.cc" "flutter_view_controller.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") ``` -------------------------------- ### Custom Link Styling and Tap Events Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/demo_en.md Customize link appearance and handle tap events using LinkConfig. ```dart Widget buildMarkdown() => MarkdownWidget( data: data, config: MarkdownConfig(configs: [ LinkConfig( style: TextStyle( color: Colors.red, decoration: TextDecoration.underline, ), onTap: (url) { ///TODO:on tap }, ) ])); ``` -------------------------------- ### Run Analyzer Source: https://github.com/asjqkkkk/markdown_widget/blob/main/CLAUDE.md Runs the Dart analyzer to check for static analysis issues. ```bash dart analyze ``` -------------------------------- ### Night Mode Configuration Source: https://github.com/asjqkkkk/markdown_widget/blob/main/README.md Enable night mode by configuring MarkdownConfig with dark theme settings. This snippet shows how to dynamically switch between default and dark configurations based on the system theme. ```dart Widget buildMarkdown(BuildContext context) { final isDark = Theme.of(context).brightness == Brightness.dark; final config = isDark ? MarkdownConfig.darkConfig : MarkdownConfig.defaultConfig; final codeWrapper = (child, text, language) => CodeWrapperWidget(child, text, language); return MarkdownWidget( data: data, config: config.copy(configs: [ isDark ? PreConfig.darkConfig.copy(wrapper: codeWrapper) : PreConfig().copy(wrapper: codeWrapper) ])); } ``` -------------------------------- ### Basic Markdown Widget Usage Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/demo_en.md Use MarkdownWidget for basic markdown rendering within a Scaffold. ```dart import 'package:flutter/material.dart'; import 'package:markdown_widget/markdown_widget.dart'; class MarkdownPage extends StatelessWidget { final String data; MarkdownPage(this.data); @override Widget build(BuildContext context) => Scaffold(body: buildMarkdown()); Widget buildMarkdown() => MarkdownWidget(data: data); } ``` -------------------------------- ### Flutter Tool Backend Custom Command Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/flutter/CMakeLists.txt Configures a custom command to run the Flutter tool backend script. This command generates the main Flutter library and its headers, ensuring they are up-to-date. ```cmake add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/_phony_ COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} VERBATIM ) ``` -------------------------------- ### Quantifier Equation Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Shows the use of universal (for all) and existential (there exists) quantifiers in a mathematical statement. ```latex $$\forall \; x \in X \quad \exists \; y \leq \epsilon$$ ``` -------------------------------- ### Flutter tool backend custom command Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/windows/flutter/CMakeLists.txt Defines a custom command to run the Flutter tool backend script. This command is set to run every time due to the use of a non-existent output file '_phony_'. ```cmake set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ${PHONY_OUTPUT} COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" windows-x64 $ VERBATIM ) ``` -------------------------------- ### Add Preprocessor Definitions for Build Version Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/windows/runner/CMakeLists.txt Sets preprocessor definitions for the build version, including major, minor, patch, and build numbers. These are useful for embedding version information directly into the compiled code. ```cmake # Add preprocessor definitions for the build version. target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") ``` -------------------------------- ### Binomial Coefficient Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Shows the formula for binomial coefficients, often read as 'n choose k'. ```latex $$\dfrac{n!}{k!(n-k)!} = \binom{n}{k}$$ ``` -------------------------------- ### Setting Application Identifiers Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/CMakeLists.txt Defines the executable name and the GTK application identifier for the project. ```cmake set(BINARY_NAME "example") set(APPLICATION_ID "com.example.example") ``` -------------------------------- ### Flutter Web App Initialization Script Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/web/index.html This JavaScript code initializes the Flutter engine and runs the application. It configures the service worker and handles the loading process, hiding the loader once the app is ready. ```javascript const serviceWorkerVersion = null; window.addEventListener('load', function(ev) { // Download main.dart.js _flutter.loader.loadEntrypoint({ serviceWorker: { serviceWorkerVersion: serviceWorkerVersion, }, onEntrypointLoaded: function(engineInitializer) { engineInitializer.initializeEngine({ useColorEmoji: true, }).then(function(appRunner) { appRunner.runApp(); document.getElementById('anim_loading').style.display = 'none'; }); } }); }); ``` -------------------------------- ### Customized Mermaid Diagram Configuration Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/demo_en.md Enables advanced customization for Mermaid diagrams, including display mode, padding, and loading indicators. Uses `createMermaidWrapper` with a detailed `MermaidConfig`. ```dart // With custom configuration final preConfig = PreConfig( wrapper: createMermaidWrapper( config: MermaidConfig( displayMode: MermaidDisplayMode.codeAndDiagram, diagramPadding: EdgeInsets.all(16.0), showLoadingIndicator: true, ), isDark: isDark, preConfig: preConfig, ), ); ``` -------------------------------- ### Set Include Directories Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/runner/CMakeLists.txt Adds the source directory to the include paths for the runner executable, allowing it to find header files within the project. ```cmake target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") ``` -------------------------------- ### MarkdownWidget Configuration for Latex Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex_description_en.md Configures the MarkdownWidget to use the custom Latex generator and syntax for parsing. ```dart Widget buildMarkdown() { ... return MarkdownWidget( data: _text, markdownGeneratorConfig: MarkdownGeneratorConfig( generators: [latexGenerator], inlineSyntaxList: [LatexSyntax()]), ); } ``` -------------------------------- ### Integral Equation Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Represents a definite integral with specified bounds. ```latex $$\int_a^b y \: \mathrm{d}x$$ ``` -------------------------------- ### Adding Flutter Subdirectory Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/CMakeLists.txt Includes the Flutter managed directory, typically containing Flutter's build rules. ```cmake set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) ``` -------------------------------- ### Mathematical Operators Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Common mathematical operators like addition, subtraction, multiplication, division, fractions, and square roots can be rendered using LaTeX. ```latex - $x + y$ - $x - y$ - $x \times y$ - $x \div y$ - $\dfrac{x}{y}$ - $\sqrt{x}$ ``` -------------------------------- ### Setting Build Type Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/CMakeLists.txt Sets the default build type to 'Debug' if not already configured, and restricts it to Debug, Profile, or Release. ```cmake if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Profile" "Release") endif() ``` -------------------------------- ### Add Application ID Preprocessor Definition Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/runner/CMakeLists.txt Adds a preprocessor definition for the application ID, using the provided APPLICATION_ID variable. ```cmake add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") ``` -------------------------------- ### Night Mode Configuration Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/demo_en.md Configure MarkdownWidget for night mode using MarkdownConfig.darkConfig and PreConfig.darkConfig. ```dart Widget buildMarkdown(BuildContext context) { final isDark = Theme.of(context).brightness == Brightness.dark; final config = isDark ? MarkdownConfig.darkConfig : MarkdownConfig.defaultConfig; final codeWrapper = (child, text, language) => CodeWrapperWidget(child, text, language); return MarkdownWidget( data: data, config: config.copy(configs: [ isDark ? PreConfig.darkConfig.copy(wrapper: codeWrapper) : PreConfig().copy(wrapper: codeWrapper) ])); } ``` -------------------------------- ### Define Flutter library headers Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/windows/flutter/CMakeLists.txt Appends Flutter library header files to the FLUTTER_LIBRARY_HEADERS list and prepends the ephemeral directory path to each. ```cmake list(APPEND FLUTTER_LIBRARY_HEADERS "flutter_export.h" "flutter_windows.h" "flutter_messenger.h" "flutter_plugin_registrar.h" "flutter_texture_registrar.h" ) list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") ``` -------------------------------- ### Define Executable Target Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/windows/runner/CMakeLists.txt Defines the main executable for the Windows runner application. Source files and resources are listed here. Ensure BINARY_NAME is consistent with the top-level CMakeLists.txt for `flutter run` to function correctly. ```cmake cmake_minimum_required(VERSION 3.14) project(runner LANGUAGES CXX) # Define the application target. To change its name, change BINARY_NAME in the # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer # work. # # Any new source files that you add to the application should be added here. add_executable(${BINARY_NAME} WIN32 "flutter_window.cpp" "main.cpp" "utils.cpp" "win32_window.cpp" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" "Runner.rc" "runner.exe.manifest" ) ``` -------------------------------- ### Equation with Text Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Integrates LaTeX mathematical expressions within regular text using the \text command. ```latex $$\text{$\dfrac{b}{a+b}=3, \: therefore we can set \: a=6$}$$ ``` -------------------------------- ### Table of Contents (TOC) Integration Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/demo_en.md Integrate TOC functionality using TocController and TocWidget for navigation. ```dart final tocController = TocController(); Widget buildTocWidget() => TocWidget(controller: tocController); Widget buildMarkdown() => MarkdownWidget(data: data, tocController: tocController); @override Widget build(BuildContext context) { return Scaffold( body: Row( children: [ Expanded(child: buildTocWidget()), Expanded(child: buildMarkdown(), flex: 3) ], )); } ``` -------------------------------- ### Colored Equation Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Renders a mathematical expression with a specified color, in this case, blue. ```latex $$\color{blue}{X \sim Normal \; (\mu,\sigma^2)}$$ ``` -------------------------------- ### Matrix of Numbers Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Displays a 3x3 matrix using the \matrix environment. ```latex $$ \begin{matrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{matrix} $$ ``` -------------------------------- ### Define List Prepend Function Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/flutter/CMakeLists.txt Defines a custom CMake function 'list_prepend' to prepend a prefix to each element in a list. This is used as a workaround for older CMake versions that lack the 'list(TRANSFORM ... PREPEND ...)' command. ```cmake function(list_prepend LIST_NAME PREFIX) set(NEW_LIST "") foreach(element ${${LIST_NAME}}) list(APPEND NEW_LIST "${PREFIX}${element}") endforeach(element) set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) endfunction() ``` -------------------------------- ### Markdown Helper Class Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/editor.md A Dart class for generating widgets from markdown nodes. It includes methods for handling title, paragraph, and preformatted text elements. ```dart class MarkdownHelper { Map getTitleWidget(m.Node node) => title.getTitleWidget(node); Widget getPWidget(m.Element node) => p.getPWidget(node); Widget getPreWidget(m.Node node) => pre.getPreWidget(node); } ``` -------------------------------- ### Define Executable Target Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/runner/CMakeLists.txt Defines the main executable target for the runner application, including source files and generated plugin registrant. ```cmake add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) ``` -------------------------------- ### Define Latex Tag Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex_description_en.md Defines a constant string for the custom Latex tag. ```dart const _latexTag = 'latex'; ``` -------------------------------- ### Adding Flutter Assemble Dependency Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/CMakeLists.txt Ensures that the flutter_assemble target is built before the application executable. ```cmake add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Limit Equation Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Shows a limit calculation where the expression approaches infinity. ```latex $$\lim_{x \to 0^+} \dfrac{1}{x} = \infty$$ ``` -------------------------------- ### Define Flutter Library Target Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/flutter/CMakeLists.txt Creates an INTERFACE library target named 'flutter'. It includes necessary header directories and links against the main Flutter library and the found GTK libraries. ```cmake add_library(flutter INTERFACE) target_include_directories(flutter INTERFACE "${EPHEMERAL_DIR}" ) target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") target_link_libraries(flutter INTERFACE PkgConfig::GTK PkgConfig::GLIB PkgConfig::GIO ) add_dependencies(flutter flutter_assemble) ``` -------------------------------- ### Markdown Generator for Custom Widgets Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/demo_en.md Use MarkdownGenerator to build widgets for custom Column or other list widgets. ```dart Widget buildMarkdown() => Column(children: MarkdownGenerator().buildWidgets(data)); ``` -------------------------------- ### Conditional Probability Equation Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Displays a conditional probability expression using LaTeX, including fractions and vertical bars for conditioning. ```latex $$P \left( A=2 \; \middle| \; \dfrac{A^2}{B}>4 \right)$$ ``` -------------------------------- ### Set ephemeral directory Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/windows/flutter/CMakeLists.txt Sets the CMAKE_CURRENT_SOURCE_DIR to the ephemeral directory, which contains generated configuration files. ```cmake set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") ``` -------------------------------- ### Piecewise Function Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Defines a piecewise function using the cases environment in LaTeX. ```latex $$ f(x)=\begin{cases} 1/d_{ij} & \quad \text{when $d_{ij} \leq 160$}\\ 0 & \quad \text{otherwise} \end{cases} $$ ``` -------------------------------- ### Add Flutter Build Dependency Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/windows/runner/CMakeLists.txt Ensures that the Flutter tool's assembly process is completed before the runner executable is built. This is a mandatory step for Flutter applications. ```cmake # Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Font Size with Text Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Applies a small font size to a LaTeX expression embedded within text. ```latex $$\small \text{Font size is small, eg. $\sum{x_i = 10}$}$$ ``` -------------------------------- ### Integrating Custom TextNodeGenerator in MarkdownWidget Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/html_description_en.md Configure the MarkdownWidget to use a custom text generator for handling specific content, such as HTML. This allows for advanced rendering capabilities beyond standard Markdown. ```dart Widget buildMarkdown() { ... return MarkdownWidget( data: _text, markdownGeneratorConfig: MarkdownGeneratorConfig( generators: [videoGeneratorWithTag]), textGenerator: (node, config, visitor) => CustomTextNode(node.textContent, config, visitor) ); } ``` -------------------------------- ### Maximum Value Notation Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Defines the maximum value of a set using subscript notation. ```latex $$\max(S) = \max_{i:S_i \in S} S_i$$ ``` -------------------------------- ### Cube Root and Square Root Equation Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Combines cube root and square root operations within a function definition. ```latex $$f(x) = \sqrt[3]{2x} + \sqrt{x-2}$$ ``` -------------------------------- ### CSS for Loader Animation Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/web/index.html This CSS defines the visual styles and animations for a loading spinner used before the Flutter application is ready. It includes styles for the loader container, inner elements, and the spinning animation itself. ```css .loader { background: #FFFFFF; bottom: 0; left: 0; overflow: hidden; position: fixed; right: 0; top: 0; z-index: 99999; } .loader-inner { bottom: 0; height: 60px; left: 0; margin: auto; position: absolute; right: 0; top: 0; width: 100px; } .loader-line-wrap { animation: spin 2000ms cubic-bezier(.175, .885, .32, 1.275) infinite ; box-sizing: border-box; height: 50px; left: 0; overflow: hidden; position: absolute; top: 0; transform-origin: 50% 100%; width: 100px; } .loader-line { border: 4px solid transparent; border-radius: 100%; box-sizing: border-box; height: 100px; left: 0; margin: 0 auto; position: absolute; right: 0; top: 0; width: 100px; } .loader-line-wrap:nth-child(1) { animation-delay: -50ms; } .loader-line-wrap:nth-child(2) { animation-delay: -100ms; } .loader-line-wrap:nth-child(3) { animation-delay: -150ms; } .loader-line-wrap:nth-child(4) { animation-delay: -200ms; } .loader-line-wrap:nth-child(5) { animation-delay: -250ms; } .loader-line-wrap:nth-child(1) .loader-line { border-color: hsl(0, 80%, 60%); height: 90px; width: 90px; top: 7px; } .loader-line-wrap:nth-child(2) .loader-line { border-color: hsl(60, 80%, 60%); height: 76px; width: 76px; top: 14px; } .loader-line-wrap:nth-child(3) .loader-line { border-color: hsl(120, 80%, 60%); height: 62px; width: 62px; top: 21px; } .loader-line-wrap:nth-child(4) .loader-line { border-color: hsl(180, 80%, 60%); height: 48px; width: 48px; top: 28px; } .loader-line-wrap:nth-child(5) .loader-line { border-color: hsl(240, 80%, 60%); height: 34px; width: 34px; top: 35px; } @keyframes spin { 0%, 15% { transform: rotate(0); } 100% { transform: rotate(360deg); } } ``` -------------------------------- ### LatexNode Class Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex_description_en.md Custom SpanNode to render Latex content using the flutter_math_fork plugin. It handles both inline and block display of mathematical expressions. ```dart class LatexNode extends SpanNode { final Map attributes; final String textContent; final MarkdownConfig config; LatexNode(this.attributes, this.textContent, this.config); @override InlineSpan build() { final content = attributes['content'] ?? ''; final isInline = attributes['isInline'] == 'true'; final style = parentStyle ?? config.p.textStyle; if (content.isEmpty) return TextSpan(style: style, text: textContent); final latex = Math.tex( content, mathStyle: MathStyle.text, textStyle: style, textScaleFactor: 1, onErrorFallback: (error) { return Text( '$textContent', style: style.copyWith(color: Colors.red), ); }, ); return WidgetSpan( child: !isInline ? Container( width: double.infinity, child: Center(child: latex), margin: EdgeInsets.symmetric(vertical: 16), ) : latex); } } ``` -------------------------------- ### Sequence Equation Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Represents a recursive sequence definition using subscript notation. ```latex $$f(X,n) = X_n + X_{n-1}$$ ``` -------------------------------- ### Mathematical Symbols Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md A wide range of mathematical symbols, including Greek letters, relational operators, logical quantifiers, set operations, and arrows, are available. ```latex - $\pi \approx 3.14159$ - $\pm \, 0.2$ - $\dfrac{0}{1} \neq \infty$ - $0 < x < 1$ - $0 \leq x \leq 1$ - $x \geq 10$ - $\forall \, x \in (1,2)$ - $\exists \, x \notin [0,1]$ - $A \subset B$ - $A \subseteq B$ - $A \cup B$ - $A \cap B$ - $X \implies Y$ - $X \impliedby Y$ - $a \to b$ - $a \longrightarrow b$ - $a \Rightarrow b$ - $a \Longrightarrow b$ - $a \propto b$ ``` -------------------------------- ### Flutter Assemble Custom Target Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/linux/flutter/CMakeLists.txt Defines a custom target 'flutter_assemble' that depends on the generated Flutter library and headers. This target ensures that the Flutter tool backend command runs when needed. ```cmake add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ) ``` -------------------------------- ### Euler's Number Series Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md Defines Euler's number 'e' using an infinite series summation. ```latex $$\mathrm{e} = \sum_{n=0}^{\infty} \dfrac{1}{n!}$$ ``` -------------------------------- ### Accents and Special Characters Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/latex.md LaTeX provides various accents for symbols and allows rendering of special characters like mathematical script, bold, ellipsis, and common symbols. ```latex - $\bar a$ - $\tilde a$ - $\breve a$ - $\hat a$ - $a^ \prime$ - $a^ \dagger$ - $a^ \ast$ - $a^ \star$ - $\mathcal A$ - $\mathrm a$ - $\cdots$ - $\vdots$ - $#$ - $\$$ - $% - $&$ - { } - _ ``` -------------------------------- ### Markdown Rendering with SingleChildScrollView Source: https://github.com/asjqkkkk/markdown_widget/blob/main/README.md Render markdown content within a SingleChildScrollView using MarkdownBlock. This is suitable for displaying long markdown documents that might exceed the screen height. ```dart Widget buildMarkdown() => SingleChildScrollView(child: MarkdownBlock(data: data)); ``` -------------------------------- ### Markdown Block for SingleChildScrollView Source: https://github.com/asjqkkkk/markdown_widget/blob/main/example/assets/demo_en.md Use MarkdownBlock within a SingleChildScrollView for scrollable markdown content. ```dart Widget buildMarkdown() => SingleChildScrollView(child: MarkdownBlock(data: data)); ```