### Build the Library with the Example Source: https://github.com/vedderb/vesc_tool/blob/master/QCodeEditor/README.md To compile the example application provided with the library, you must specify the `-DBUILD_EXAMPLE=On` flag during the CMake configuration step. This command should be run from within the build directory. ```CMake cmake .. -DBUILD_EXAMPLE=On ``` -------------------------------- ### Parse Markdown to HTML in C++ Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/README.md This example shows the basic usage of the maddy library in a C++ application. It includes the necessary headers, creates a parser instance with an optional configuration, and then calls the Parse method to convert a Markdown input stream to an HTML string. ```cpp #include #include #include "maddy/parser.h" std::stringstream markdownInput(""); // config is optional std::shared_ptr config = std::make_shared(); // config->isEmphasizedParserEnabled = false; // default true - this flag is deprecated // config->isHTMLWrappedInParagraph = false; // default true - this flag is deprecated config->enabledParsers &= ~maddy::types::EMPHASIZED_PARSER; // equivalent to !isEmphasizedParserEnabled config->enabledParsers |= maddy::types::HTML_PARSER; // equivalent to !isHTMLWrappedInParagraph std::shared_ptr parser = std::make_shared(config); std::string htmlOutput = parser->Parse(markdownInput); ``` -------------------------------- ### Create Links in Markdown Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md Shows the syntax for creating a hyperlink in markdown using square brackets for the link text and parentheses for the URL. The example is converted to an HTML `` tag. ```markdown [Text of the link](http://example.com) ``` ```html Text of the link ``` -------------------------------- ### Format a Git Commit Message Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/CONTRIBUTING.md This snippet provides an example of the recommended format for a Git commit message. It consists of a short, single-line description, followed by a blank line and then a more detailed, multi-line explanation for more complex changes. ```plaintext Short description More and longer text for the commit message with some more information. That can go over multiple lines. ``` -------------------------------- ### Decode an MP3 File in C using mp3dec_load Source: https://github.com/vedderb/vesc_tool/blob/master/minimp3/README.md This example demonstrates how to decode an entire MP3 file using the `mp3dec_load` function. It initializes the decoder, loads the file into an `mp3dec_file_info_t` struct, and includes a comment on how to deallocate the buffer containing the decoded samples. ```C mp3dec_t mp3d; mp3dec_file_info_t info; if (mp3dec_load(&mp3d, input_file_name, &info, NULL, NULL)) { /* error */ } /* mp3dec_file_info_t contains decoded samples and info, use free(info.buffer) to deallocate samples */ ``` -------------------------------- ### LaTeX Formula Input Example Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md An example of a LaTeX mathematical formula that can be processed by the maddy parser once LaTeX support is enabled. This shows the quadratic formula enclosed in double dollar signs. ```latex $$x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}.$$ ``` -------------------------------- ### Compress and Decompress Data with lzokay in C++ Source: https://github.com/vedderb/vesc_tool/blob/master/lzokay/README.md This example demonstrates the complete workflow for using the lzokay library. It covers estimating the required buffer size for the compressed output, performing the compression, decompressing the data back to its original state, and finally verifying the integrity of the decompressed data using `std::memcmp`. The use of an optional `lzokay::Dict` object is also shown, which can be reused across multiple compression calls to improve performance by avoiding repeated memory allocations. ```C++ #include #include int compress_and_decompress(const uint8_t* data, std::size_t length) { lzokay::EResult error; /* This variable and 6th parameter of compress() is optional, but may * be reused across multiple compression runs; avoiding repeat * allocation/deallocation of the work memory used by the compressor. */ lzokay::Dict<> dict; std::size_t estimated_size = lzokay::compress_worst_size(length); std::unique_ptr compressed(new uint8_t[estimated_size]); std::size_t compressed_size; error = lzokay::compress(data, length, compressed.get(), estimated_size, compressed_size, dict); if (error < lzokay::EResult::Success) return 1; std::unique_ptr decompressed(new uint8_t[length]); std::size_t decompressed_size; error = lzokay::decompress(compressed.get(), compressed_size, decompressed.get(), length, decompressed_size); if (error < lzokay::EResult::Success) return 1; if (std::memcmp(data, decompressed.get(), decompressed_size) != 0) return 1; return 0; } ``` -------------------------------- ### CMake Build Script for qmarkdowntextedit Source: https://github.com/vedderb/vesc_tool/blob/master/qmarkdowntextedit/CMakeLists.txt This CMakeLists.txt file configures the build system for the 'qmarkdowntextedit' project. It requires CMake 3.16 and Qt, sets the C++ standard to 11, and uses AUTOMOC, AUTOUIC, and AUTORCC. The script builds the 'qmarkdowntextedit' library and an optional test executable, linking against Qt Widgets and handling installation of the library, headers, and a pkg-config file. ```cmake cmake_minimum_required(VERSION 3.16) # Qt requires CMake 3.16 project(qmarkdowntextedit LANGUAGES CXX VERSION 1.0.0) #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) # add option to disable test executable option(QMARKDOWNTEXTEDIT_EXE "Build test executable" ON) # find qt find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS Quick) # needed for windows if(WIN32) set(INTL_LDFLAGS -lintl) endif(WIN32) # QMarkdownTextEdit library set(RC_FILES media.qrc ) # Translations arent loaded so don't include them set(TS_FILES trans/qmarkdowntextedit_de.ts trans/qmarkdowntextedit_ur.ts trans/qmarkdowntextedit_zh_CN.ts ) set(QMARKDOWNTEXTEDIT_SOURCES ${RC_FILES} linenumberarea.h # We need to keep this here, otherwise the build fails markdownhighlighter.cpp qmarkdowntextedit.cpp qownlanguagedata.cpp qownlanguagedata.h qplaintexteditsearchwidget.cpp qplaintexteditsearchwidget.ui ) set(QMARKDOWNTEXTEDIT_HEADERS markdownhighlighter.h qmarkdowntextedit.h qplaintexteditsearchwidget.h ) add_library(qmarkdowntextedit ${QMARKDOWNTEXTEDIT_SOURCES}) set_target_properties(qmarkdowntextedit PROPERTIES PUBLIC_HEADER "${QMARKDOWNTEXTEDIT_HEADERS}" ) target_link_libraries(qmarkdowntextedit PUBLIC Qt${QT_VERSION_MAJOR}::Widgets ${INTL_LDFLAGS} ) if (Qt${QT_VERSION_MAJOR}Quick_FOUND) target_link_libraries(qmarkdowntextedit PUBLIC Qt${QT_VERSION_MAJOR}::Quick) add_executable(QtQuickExample examples/qml/example.cpp examples/qml/ressources.qrc) target_link_libraries(QtQuickExample PRIVATE Qt${QT_VERSION_MAJOR}::Quick qmarkdowntextedit) endif() # QMarkdownTextEdit executable if(QMARKDOWNTEXTEDIT_EXE) set(SOURCE_FILES main.cpp mainwindow.cpp mainwindow.h mainwindow.ui ) add_executable(qmarkdowntextedit-exe ${SOURCE_FILES}) set_target_properties(qmarkdowntextedit-exe PROPERTIES OUTPUT_NAME "qmarkdowntextedit") target_link_libraries(qmarkdowntextedit-exe PRIVATE Qt${QT_VERSION_MAJOR}::Widgets ${INTL_LDFLAGS} qmarkdowntextedit ) endif() include(GNUInstallDirs) # Doesn't fail on windows # Install the lib install(TARGETS qmarkdowntextedit ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) # Add PkgConfig config file configure_file(qmarkdowntextedit.pc.in ${CMAKE_BINARY_DIR}/qmarkdowntextedit.pc @ONLY) install(FILES ${CMAKE_BINARY_DIR}/qmarkdowntextedit.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) # Install exe if(QMARKDOWNTEXTEDIT_EXE) install(TARGETS qmarkdowntextedit-exe DESTINATION bin) endif() ``` -------------------------------- ### Create a Nested Ordered List in Markdown Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md Illustrates creating a nested ordered list by indenting items. The example shows a mix of numbered and un-numbered markers which still produce a nested `
    ` structure. ```markdown 1. ordered * list 1. items * in 1. an * hierarchy ``` ```html
    1. ordered
    2. list
      1. items
      2. in
        1. an
      3. hierarchy
    ``` -------------------------------- ### Build and Run Tests from Source Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/README.md These shell commands outline the process for cloning the maddy repository, creating a build directory, configuring the project with CMake to include tests, and then compiling and running the test suite. ```shell git clone https://github.com/progsource/maddy.git cd maddy mkdir tmp cd tmp cmake -DMADDY_BUILD_WITH_TESTS=ON .. make make test # or run the executable in ../build/MaddyTests ``` -------------------------------- ### Create a QtQuick (QML) VESC Tool Application Source: https://github.com/vedderb/vesc_tool/blob/master/application/README.md To create a QtQuick (QML) based application, run the `create_app` script with the application name followed by the `qml` argument. ```bash ./create_app app_name qml ``` -------------------------------- ### Initialize Submodules After Cloning Source: https://github.com/vedderb/vesc_tool/blob/master/esp32/README.md If the repository was cloned without the --recursive flag, run this command to initialize and fetch the necessary submodules, such as stm32-cmake. ```bash git submodule update --init ``` -------------------------------- ### Initialize the minimp3 Decoder in C Source: https://github.com/vedderb/vesc_tool/blob/master/minimp3/README.md This snippet demonstrates how to initialize the minimp3 decoder. It requires defining `MINIMP3_IMPLEMENTATION` in exactly one source file before including `minimp3.h`. Several optional preprocessor defines like `MINIMP3_FLOAT_OUTPUT` or `MINIMP3_NO_SIMD` can be used to customize the library's features and performance. ```c //#define MINIMP3_ONLY_MP3 //#define MINIMP3_ONLY_SIMD //#define MINIMP3_NO_SIMD //#define MINIMP3_NONSTANDARD_BUT_LOGICAL //#define MINIMP3_FLOAT_OUTPUT #define MINIMP3_IMPLEMENTATION #include "minimp3.h" ... static mp3dec_t mp3d; mp3dec_init(&mp3d); ``` -------------------------------- ### Build the Library with CMake Source: https://github.com/vedderb/vesc_tool/blob/master/QCodeEditor/README.md This sequence of shell commands outlines the process for cloning the QCodeEditor repository and building it as a static library using CMake. This is the standard procedure for compiling the library for external use. ```Shell git clone https://github.com/Megaxela/QCodeEditor cd QCodeEditor mkdir build cd build cmake .. cmake --build . ``` -------------------------------- ### Create a Standard VESC Tool Application Source: https://github.com/vedderb/vesc_tool/blob/master/application/README.md This command creates a standard application using the VESC Tool backend. You must provide a name for your application as an argument. ```bash ./create_app app_name ``` -------------------------------- ### Integrate maddy with CMake using FetchContent Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/README.md This snippet demonstrates how to add the maddy library to a C++ project using CMake's FetchContent module. It declares the maddy dependency from a URL, makes it available, and links it to an executable target. ```cmake include(FetchContent) FetchContent_Declare( maddy URL https://github.com/progsource/maddy/.../maddy-src.zip ) FetchContent_MakeAvailable(maddy) add_executable(my_exe) target_link_libraries(my_exe PUBLIC maddy) ``` -------------------------------- ### Create a Simple Ordered List in Markdown Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md Shows how to create a basic ordered list using numbered items. The output is an HTML `
      ` element. ```markdown 1. ordered 2. list 3. items ``` ```html
      1. ordered
      2. list
      3. items
      ``` -------------------------------- ### minimp3 High-Level API Reference Source: https://github.com/vedderb/vesc_tool/blob/master/minimp3/README.md This is the API reference for the `minimp3_ex.h` high-level functions. It defines constants like seek modes and buffer sizes, data structures for file info (`mp3dec_file_info_t`) and I/O (`mp3dec_io_t`), and function prototypes for decoding, iterating, and streaming MP3 data with seeking capabilities. ```C #define MP3D_SEEK_TO_BYTE 0 #define MP3D_SEEK_TO_SAMPLE 1 #define MINIMP3_PREDECODE_FRAMES 2 /* frames to pre-decode and skip after seek (to fill internal structures) */ /*#define MINIMP3_SEEK_IDX_LINEAR_SEARCH*/ /* define to use linear index search instead of binary search on seek */ #define MINIMP3_IO_SIZE (128*1024) /* io buffer size for streaming functions, must be greater than MINIMP3_BUF_SIZE */ #define MINIMP3_BUF_SIZE (16*1024) /* buffer which can hold minimum 10 consecutive mp3 frames (~16KB) worst case */ #define MINIMP3_ENABLE_RING 0 /* enable hardware magic ring buffer if available, to make less input buffer memmove(s) in callback IO mode */ #define MP3D_E_MEMORY -1 #define MP3D_E_IOERROR -2 typedef struct { mp3d_sample_t *buffer; size_t samples; /* channels included, byte size = samples*sizeof(mp3d_sample_t) */ int channels, hz, layer, avg_bitrate_kbps; } mp3dec_file_info_t; typedef size_t (*MP3D_READ_CB)(void *buf, size_t size, void *user_data); typedef int (*MP3D_SEEK_CB)(uint64_t position, void *user_data); typedef struct { MP3D_READ_CB read; void *read_data; MP3D_SEEK_CB seek; void *seek_data; } mp3dec_io_t; typedef struct { uint64_t samples; mp3dec_frame_info_t info; int last_error; ... } mp3dec_ex_t; typedef int (*MP3D_ITERATE_CB)(void *user_data, const uint8_t *frame, int frame_size, int free_format_bytes, size_t buf_size, uint64_t offset, mp3dec_frame_info_t *info); typedef int (*MP3D_PROGRESS_CB)(void *user_data, size_t file_size, uint64_t offset, mp3dec_frame_info_t *info); /* decode whole buffer block */ int mp3dec_load_buf(mp3dec_t *dec, const uint8_t *buf, size_t buf_size, mp3dec_file_info_t *info, MP3D_PROGRESS_CB progress_cb, void *user_data); int mp3dec_load_cb(mp3dec_t *dec, mp3dec_io_t *io, uint8_t *buf, size_t buf_size, mp3dec_file_info_t *info, MP3D_PROGRESS_CB progress_cb, void *user_data); /* iterate through frames */ int mp3dec_iterate_buf(const uint8_t *buf, size_t buf_size, MP3D_ITERATE_CB callback, void *user_data); int mp3dec_iterate_cb(mp3dec_io_t *io, uint8_t *buf, size_t buf_size, MP3D_ITERATE_CB callback, void *user_data); /* streaming decoder with seeking capability */ int mp3dec_ex_open_buf(mp3dec_ex_t *dec, const uint8_t *buf, size_t buf_size, int seek_method); int mp3dec_ex_open_cb(mp3dec_ex_t *dec, mp3dec_io_t *io, int seek_method); void mp3dec_ex_close(mp3dec_ex_t *dec); int mp3dec_ex_seek(mp3dec_ex_t *dec, uint64_t position); size_t mp3dec_ex_read(mp3dec_ex_t *dec, mp3d_sample_t *buf, size_t samples); #ifndef MINIMP3_NO_STDIO /* stdio versions of file load, iterate and stream */ int mp3dec_load(mp3dec_t *dec, const char *file_name, mp3dec_file_info_t *info, MP3D_PROGRESS_CB progress_cb, void *user_data); int mp3dec_iterate(const char *file_name, MP3D_ITERATE_CB callback, void *user_data); int mp3dec_ex_open(mp3dec_ex_t *dec, const char *file_name, int seek_method); #ifdef _WIN32 int mp3dec_load_w(mp3dec_t *dec, const wchar_t *file_name, mp3dec_file_info_t *info, MP3D_PROGRESS_CB progress_cb, void *user_data); int mp3dec_iterate_w(const wchar_t *file_name, MP3D_ITERATE_CB callback, void *user_data); int mp3dec_ex_open_w(mp3dec_ex_t *dec, const wchar_t *file_name, int seek_method); #endif #endif ``` -------------------------------- ### Configure STM32 Build in CMakeLists.txt Source: https://github.com/vedderb/vesc_tool/blob/master/esp32/README.md Alternatively, you can set the required variables for the STM32 build directly within the top-level CMakeLists.txt file instead of passing them on the command line. ```cmake set(TOOLCHAIN_PREFIX path_to_toolchain) set(STM32Cube_DIR path_to_stm32_HAL) set(STM32_CHIP STM32F407VG) set(PORT STM32) ``` -------------------------------- ### Clone Repository with STM32 Support Submodules Source: https://github.com/vedderb/vesc_tool/blob/master/esp32/README.md To compile the project with STM32 support, the stm32-cmake submodule is required. Clone the repository using the --recursive flag to automatically fetch it. ```bash git clone --recursive https://github.com/espressif/esp-serial-flasher.git ``` -------------------------------- ### Create a Basic Code Block in Markdown Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md Shows how to create a generic code block using triple backticks. This is rendered into an HTML `
      ` block.
      
      ```markdown
      ```
      some code
      ```
      ```
      
      ```html
      
      
      some code
      
      ``` -------------------------------- ### Decode an MP3 with Seeking in C using mp3dec_ex Source: https://github.com/vedderb/vesc_tool/blob/master/minimp3/README.md This code illustrates how to use the extended API for decoding with seeking capabilities. It opens a file using `mp3dec_ex_open`, seeks to a specific sample position with `mp3dec_ex_seek`, and then reads the decoded audio data into a buffer using `mp3dec_ex_read`. Error handling for both end-of-file and other errors is also shown. ```C mp3dec_ex_t dec; if (mp3dec_ex_open(&dec, input_file_name, MP3D_SEEK_TO_SAMPLE)) { /* error */ } /* dec.samples, dec.info.hz, dec.info.layer, dec.info.channels should be filled */ if (mp3dec_ex_seek(&dec, position)) { /* error */ } mp3d_sample_t *buffer = malloc(dec.samples*sizeof(mp3d_sample_t)); size_t readed = mp3dec_ex_read(&dec, buffer, dec.samples); if (readed != dec.samples) /* normal eof or error condition */ { if (dec.last_error) { /* error */ } } ``` -------------------------------- ### Create a Simple Unordered List in Markdown Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md Demonstrates creating a basic unordered list in markdown using '-', '*', or '+'. The output is an HTML `
        ` element. ```markdown - unordered * list + items ``` ```html
        • unordered
        • list
        • items
        ``` -------------------------------- ### Create a Syntax-Highlighted Code Block in Markdown Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md Demonstrates creating a code block with language-specific syntax highlighting by specifying the language (e.g., 'cpp') after the opening backticks. The resulting `
        ` tag includes a class for the specified language.
        
        ```markdown
        ```cpp
        int a = 42;
        ```
        ```
        
        ```html
        
        
        int a = 42;
        
        ``` -------------------------------- ### Create an Ordered List with Mixed Markers Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md Demonstrates that an ordered list can be created even when using unordered markers like '*' for subsequent items, as long as the first item is numbered. The result is a standard HTML `
          `. ```markdown 1. ordered * list * items ``` ```html
          1. ordered
          2. list
          3. items
          ``` -------------------------------- ### Configure STM32 Build with CMake Command Line Source: https://github.com/vedderb/vesc_tool/blob/master/esp32/README.md To build for an STM32 target, provide the toolchain path, STM32Cube directory, chip name, and port name as definitions to the CMake command. ```cmake cmake -DTOOLCHAIN_PREFIX="/path_to_toolchain" -DSTM32Cube_DIR="path_to_stm32Cube" -DSTM32_CHIP="STM32F407VG" -DPORT="STM32" .. && cmake --build . ``` -------------------------------- ### Create a Checklist in Markdown Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md Demonstrates the syntax for creating a checklist with checked and unchecked items. The resulting HTML uses a `
            ` with a 'checklist' class and includes `` elements. ```markdown - [ ] some item - [ ] another item - [x] some checked item ``` ```html
            ``` -------------------------------- ### Required Port Functions for New Host Targets Source: https://github.com/vedderb/vesc_tool/blob/master/esp32/README.md To support a new host microcontroller, the user must implement these C functions. They handle serial communication, bootloader entry, timing, and other low-level operations required by the flasher library. Prototypes can be found in serial_io.h. ```c loader_port_serial_read() loader_port_serial_write() loader_port_enter_bootloader() loader_port_delay_ms() loader_port_start_timer() loader_port_remaining_time() ``` -------------------------------- ### Enable LaTeX Parser in C++ Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md This C++ code demonstrates how to enable the LaTeX block parser in the maddy library. It creates a parser configuration, adds the LATEX_BLOCK_PARSER flag, and then initializes the parser with this configuration. ```cpp std::shared_ptr config = std::make_shared(); config->enabledParsers |= maddy::types::LATEX_BLOCK_PARSER; std::shared_ptr parser = std::make_shared(config); std::string htmlOutput = parser->Parse(markdownInput); ``` -------------------------------- ### Create Headings in Markdown Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md Demonstrates how to create headings from h1 to h6 using the hash symbol (#) in markdown. The corresponding HTML output for each heading level is shown. ```markdown # h1 heading ## h2 heading ### h3 heading #### h4 heading ##### h5 heading ###### h6 heading ``` ```html

            h1 heading

            h2 heading

            h3 heading

            h4 heading

            h5 heading
            h6 heading
            ``` -------------------------------- ### Apply Bold Formatting in Markdown Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md Demonstrates two equivalent ways to make text bold: by wrapping it in double asterisks (**) or double underscores (__). Both methods produce an HTML `` tag. ```markdown **bold text** __bold text__ ``` ```html bold text bold text ``` -------------------------------- ### Decode an MP3 Frame in C Source: https://github.com/vedderb/vesc_tool/blob/master/minimp3/README.md This code shows how to decode a single MP3 frame using `mp3dec_decode_frame()`. The function takes the initialized decoder, an input buffer, and outputs PCM data and frame information. The return value indicates the number of decoded samples, and the `info.frame_bytes` field specifies how much data was consumed from the input buffer, which must be managed by the application for the next call. ```c /*typedef struct { int frame_bytes; int channels; int hz; int layer; int bitrate_kbps; } mp3dec_frame_info_t;*/ mp3dec_frame_info_t info; short pcm[MINIMP3_MAX_SAMPLES_PER_FRAME]; /*unsigned char *input_buf; - input byte stream*/ samples = mp3dec_decode_frame(&mp3d, input_buf, buf_size, pcm, &info); ``` -------------------------------- ### Integrate QMarkdownTextEdit with QMake and CMake Source: https://github.com/vedderb/vesc_tool/blob/master/qmarkdowntextedit/README.md To integrate the QMarkdownTextEdit widget into your project, use the appropriate command for your build system. For QMake, include the provided .pri file in your project file. For CMake, add the source directory as a subdirectory in your CMakeLists.txt. After integration, you can promote a standard QPlainTextEdit to QMarkdownTextEdit in your UI. ```qmake include (qmarkdowntextedit/qmarkdowntextedit.pri) ``` ```cmake add_subdirectory(qmarkdowntextedit) ``` -------------------------------- ### Optional Helper Functions for Host Port Source: https://github.com/vedderb/vesc_tool/blob/master/esp32/README.md These functions from serial_io.h are provided for convenience but are not called directly by the library. Users can implement their own versions for tasks like changing the baud rate, resetting the target, and printing debug information. ```c loader_port_change_baudrate() loader_port_reset_target() loader_port_debug_print() ``` -------------------------------- ### Create a Table in Markdown Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md Demonstrates the maddy parser's custom syntax for creating tables with optional headers, bodies, and footers. The table structure is defined between `|table>` and `| Left header | middle header | last header - | - | - cell 1 | cell 2 | cell 3 cell 4 | cell 5 | cell 6 - | - | - foot a | foot b | foot c |
            Left header middle header last header
            cell 1 cell 2 cell 3
            cell 4 cell 5 cell 6
            foot a foot b foot c
            ``` -------------------------------- ### Create a Blockquote in Markdown Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md Shows how to create a blockquote by prefixing a line with the greater-than symbol (>). The output is an HTML `
            ` containing a `

            ` tag. ```markdown > Some quote ``` ```html

            Some quote

            ``` -------------------------------- ### Create Inline Code in Markdown Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md Illustrates how to format a small piece of code within a line of text by wrapping it in single backticks. This is converted to an HTML `` tag. ```markdown some text `some inline code` some other text ``` ```html some text some inline code some other text ``` -------------------------------- ### Apply Emphasized Formatting in Markdown Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md Illustrates how to emphasize text by wrapping it in single underscores (_). This produces an HTML `` tag and can be disabled via a configuration setting. ```markdown _emphasized text_ ``` ```html emphasized text ``` -------------------------------- ### Apply Strikethrough Formatting in Markdown Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md Shows how to strike through text by wrapping it in double tildes (~~). This is converted to an HTML `` tag. ```markdown ~~striked through text~~ ``` ```html striked through text ``` -------------------------------- ### Heatshrink API Usage Flow Source: https://github.com/vedderb/vesc_tool/blob/master/heatshrink/README.md Describes the basic operational flow for using the heatshrink encoder or decoder. This involves allocating and initializing a state machine, sinking input data, polling for output data, and finishing the stream to flush any remaining buffered output. ```APIDOC // Basic Usage Flow 1. Initialization: - Allocate a `heatshrink_encoder` or `heatshrink_decoder` state machine. - Use `alloc()` for dynamic allocation. - Or, statically allocate and call `reset()` to initialize. 2. Sinking Input Data: - Call `sink(input_buffer, &input_size)` to feed data into the state machine. - The `input_size` pointer is updated to show how many bytes were consumed. - If `input_size` is 0, the internal buffer is full. 3. Polling for Output Data: - Call `poll(output_buffer, &output_size)` to retrieve processed data. - The `output_size` pointer is updated with the number of bytes written. - The return value indicates if more output is available. 4. Streaming: - Repeat steps 2 and 3 to process a continuous stream of data. 5. Finishing the Stream: - Call `finish()` when no more input data is available. - The return value indicates if buffered output remains. - Continue calling `poll()` and `finish()` until `finish()` indicates the stream is fully flushed. Note: After `finish()` is called, `reset()` must be called before sinking new data. ``` -------------------------------- ### Create a Nested Unordered List in Markdown Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md Shows how to create a nested unordered list by indenting list items. The markdown is converted into a nested HTML `
              ` structure. ```markdown * unordered * list * items * in + an - hierarchy ``` ```html
              • unordered
                • list
                • items
                  • in
                  • an
                • hierarchy
              ``` -------------------------------- ### Create a Combined Unordered and Ordered List Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md Shows how to combine unordered and ordered lists by nesting an ordered list within an unordered one. The markdown is converted to nested `
                ` and `
                  ` HTML tags. ```markdown * combination * of 1. unordered and * ordered * list ``` ```html
                  • combination
                  • of
                    1. unordered and
                    2. ordered
                  • list
                  ``` -------------------------------- ### Resulting HTML Output for LaTeX Formula Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md This is the resulting HTML output after the maddy parser processes the LaTeX input. The formula is preserved within the double dollar signs, ready for rendering by a client-side library like MathJax. ```html $$x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}.$$\n ``` -------------------------------- ### Use MarkdownHighlighter with QPlainTextEdit in C++ Source: https://github.com/vedderb/vesc_tool/blob/master/qmarkdowntextedit/README.md This C++ code demonstrates how to apply the MarkdownHighlighter directly to a QPlainTextEdit widget's document. This is useful for adding Markdown syntax highlighting without using the full QMarkdownTextEdit widget. The highlighter is created with the text edit's document as its parent. ```cpp auto doc = ui->plainTextEdit->document(); auto *highlighter = new MarkdownHighlighter(doc); ``` -------------------------------- ### Apply Italic Formatting in Markdown Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md Shows how to italicize text by wrapping it in single asterisks (*). This is converted to an HTML `` tag. ```markdown *italic text* ``` ```html italic text ``` -------------------------------- ### Embed an Image in Markdown Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md Illustrates the syntax for embedding an image, which includes an exclamation mark, alt text in square brackets, and the image URL in parentheses. This is converted to an HTML `` tag. ```markdown ![Image alt text](http://example.com/example.png) ``` ```html Image alt text ``` -------------------------------- ### Heatshrink Configuration Parameters Source: https://github.com/vedderb/vesc_tool/blob/master/heatshrink/README.md Details the configuration options for the heatshrink encoder and decoder, which control memory usage and compression effectiveness. These can be set during dynamic allocation or in `heatshrink_config.h` for static allocation. ```APIDOC // Configuration Parameters // Set in heatshrink_config.h (static) or via alloc() (dynamic). - window_sz2: (CLI: -w) - Description: Sets the window size to 2^W bytes. Determines how far back to search for repeated patterns. - Constraints: Must be between 4 and 15. - Recommended: 8 to 10 for embedded contexts. - lookahead_sz2: (CLI: -l) - Description: Sets the lookahead size to 2^L bytes. Determines the max length for a repeated pattern. - Constraints: Must be between 3 and (window_sz2 - 1). - Recommended: Start near window_sz2 / 2 (e.g., -w 8 -l 4). - input_buffer_size: - Description: (Decoder only) Sets the size of the input buffer. Affects how much work the decoder can do in one step. - Impact: A larger buffer uses more memory but can reduce function call overhead. ``` -------------------------------- ### Create a Line Break in Markdown Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md Shows how to insert a line break using escaped newline characters (\r\n). This is converted to an HTML `
                  ` tag. ```markdown New\r\nLine ``` ```html New
                  Line ``` -------------------------------- ### Create a Horizontal Rule in Markdown Source: https://github.com/vedderb/vesc_tool/blob/master/maddy/docs/definitions.md Demonstrates how to create a horizontal rule (line) by using three or more hyphens (---). This produces an HTML `
                  ` tag. ```markdown --- ``` ```html
                  ``` -------------------------------- ### Enable MD5 Flash Integrity Check using CMake Source: https://github.com/vedderb/vesc_tool/blob/master/esp32/README.md To enable flash integrity verification after writing to memory, pass the MD5_ENABLED option to CMake during configuration. This is enabled by default for ESP32 but must be disabled for ESP8266 as its ROM bootloader does not support it. ```cmake cmake -DMD5_ENABLED=1 .. && cmake --build . ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.