A method and system for automatically generating a user manual by online editing

Automatically generate user manuals through the online editing system, the problem of low user manual update efficiency in the existing technology is solved, efficient and automatic user manual generation and update are achieved, and the readability and maintenance of user manuals are improved.

CN119294361BActive Publication Date: 2025-03-11CHANGJIANG SECURITIES
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411842747.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-03-11
Estimated Expiration
2044-12-13

AI Technical Summary

Technical Problem

The user manual update efficiency of the existing fund manager service platform is inefficient, and it is impossible to achieve online editing and automatic updates, and requires manual deployment by developers.

Method used

It provides a method and system that supports online editing and automatically generates user manuals. By obtaining user input data content, converting it into multiple data items, judging the data item type, if it is a content type, it is converted to a DOM tree, and converting it to a Markdown document according to preset rules.

Benefits of technology

It realizes efficient generation and update of user manuals, reduces manual intervention, improves the efficiency and readability of user manuals, and supports online editing and automatic updates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119294361B_ABST
    Figure CN119294361B_ABST
Patent Text Reader

Abstract

The present application provides a method and system for supporting online editing and automatic generation of user manuals, which relates to the technical field of software development. The method includes: obtaining user input data content; converting the data content into multiple data items, the data items including type values ​​and value values; judging whether the type type of the data item is a content type according to the type value; if the type type is determined to be a content type, converting the value value into a DOM tree; according to preset rules, converting the DOM tree into a Markdown document. If the type type is determined to be a title type, converting the value value into a Markdown document according to the title level of the data item. The present application can automatically convert documents into computer syntax to improve the efficiency of user manual generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of software development, and in particular to a method and system for supporting online editing and automatic generation of user manuals. Background Art

[0002] The Fund Manager Service Platform is a comprehensive operational support platform provided by financial institutions with asset custody or outsourcing qualifications to fund managers. The platform is designed to help fund managers simplify and automate their operational processes, ensure fund management compliance, data security and maximize investor interests.

[0003] The fund manager service platform usually includes a system user manual, which is an indispensable resource for users to understand and use the system efficiently. It can not only improve the user experience, but also reduce the problems caused by user errors and improve work efficiency. Some professional financial words need to be updated frequently in the system user manual. The docsify online document system is a document generation system that generates document websites from document source files written in Markdown language. It is often used to make system user manuals.

[0004] However, currently, business personnel write word documents containing financial terms, and then forward the word documents to developers, who convert the word documents into computer syntax and finally package and deploy them online as system user manuals. After the document is deployed online, if the content needs to be changed, the developer must manually redeploy it, and online editing and automatic updating are not possible. Summary of the invention

[0005] The present application provides a method and system for supporting online editing and automatic generation of user manuals, which can automatically convert documents into computer grammar to improve the efficiency of user manual generation.

[0006] In a first aspect of the present application, a method for supporting online editing and automatically generating a user manual is provided, the method comprising:

[0007] Get the user input data content;

[0008] Convert the data content into multiple data items, each of which includes a type value and a value value;

[0009] Determine whether the type of the data item is a content type according to the type value;

[0010] If it is determined that the type is a content type, convert the value into a DOM tree;

[0011] According to preset rules, the DOM tree is converted into a Markdown document.

[0012] Optionally, after determining whether the type of the data item is a content type according to the type value, the method further includes:

[0013] If it is determined that the type is a title type, the value is converted into a Markdown document according to the title level of the data item.

[0014] Optionally, if it is determined that the type is a content type, converting the value into a DOM tree specifically includes:

[0015] Perform lexical analysis on the string contained in the value;

[0016] Generate multiple element nodes according to the result of lexical analysis of the string;

[0017] Determine the node type of the element node according to the result of lexical analysis of the string;

[0018] According to the nested structure of the value corresponding to the node type, construct the parent-child node relationship of the plurality of element nodes;

[0019] A tree model is constructed for the plurality of element nodes according to the parent-child node relationship to obtain the DOM tree.

[0020] Optionally, converting the DOM tree into a Markdown document according to a preset rule specifically includes:

[0021] Traverse each element node of the DOM tree by depth-first traversal or breadth-first traversal;

[0022] According to a preset rule, each of the element nodes is converted into Markdown syntax to obtain a first fragment, wherein the preset rule is a mapping rule between HTML and Markdown syntax;

[0023] Escaping the preset special elements in the plurality of element nodes to obtain a second fragment;

[0024] The first segment and the second segment are merged to obtain the Markdown document.

[0025] Optionally, if it is determined that the type is a title type, converting the value into a Markdown document according to the title level of the data item specifically includes:

[0026] determining a heading level for the data item;

[0027] Map said heading levels to Markdown headings;

[0028] The value is processed, and the processed result is placed after the Markdown title to obtain the Markdown document.

[0029] Optionally, after performing lexical analysis on the character string contained in the value, the method further includes:

[0030] Parse the nested structure of the value to determine multiple segmentation points;

[0031] According to the plurality of segmentation points, the nested structure is segmented to obtain a plurality of blocks;

[0032] Determine a plurality of first screen blocks corresponding to the first screen content, and construct the element nodes for the first screen blocks;

[0033] Determine the delayed blocks except the first screen block among the multiple blocks, and delay the construction of the element nodes for the delayed blocks according to the display order.

[0034] Optionally, converting the DOM tree into a Markdown document according to a preset rule specifically further includes:

[0035] Determine the DOM structure of the DOM tree;

[0036] Determine the nesting level supported by Markdown;

[0037] The deep structure exceeding the nesting level in the DOM structure is flattened into flat list items, and ordered and unordered lists are used to represent the hierarchical relationship of the deep structure.

[0038] In a second aspect of the present application, a device for supporting online editing and automatically generating a user manual is provided, the device comprising an acquisition module, a conversion module and a judgment module, wherein:

[0039] The acquisition module is used to acquire the data content input by the user;

[0040] The conversion module is used to convert the data content into multiple data items, wherein the data items include type values ​​and value values;

[0041] The judging module is used to judge whether the type of the data item is a content type according to the type value;

[0042] The conversion module is used to convert the value into a DOM tree if it is determined that the type is a content type;

[0043] The conversion module is used to convert the DOM tree into a Markdown document according to preset rules.

[0044] Optionally, the conversion module is used to convert the value into a Markdown document according to the title level of the data item if it is determined that the type is a title type.

[0045] Optionally, the conversion module is used to perform lexical analysis on the character string contained in the value;

[0046] The conversion module is used to generate multiple element nodes according to the result of lexical analysis of the string;

[0047] The judgment module is used to determine the node type of the element node according to the result of the lexical analysis of the string;

[0048] The conversion module is used to construct a parent-child node relationship of a plurality of the element nodes according to a nested structure of a value corresponding to the node type;

[0049] The conversion module is used to construct a tree model for the plurality of element nodes according to the parent-child node relationship to obtain the DOM tree.

[0050] Optionally, the acquisition module is used to traverse each element node of the DOM tree through depth-first traversal or breadth-first traversal;

[0051] The conversion module is used to convert each of the element nodes into Markdown syntax according to a preset rule to obtain a first fragment, wherein the preset rule is a mapping rule between HTML and Markdown syntax;

[0052] The conversion module is used to escape the preset special elements in the plurality of element nodes to obtain a second segment;

[0053] The conversion module is used to merge the first segment and the second segment to obtain the Markdown document.

[0054] Optionally, the judgment module is used to determine the title level of the data item;

[0055] The conversion module is used to map the heading level to the Markdown heading;

[0056] The conversion module is used to process the value and place the processed result after the Markdown title to obtain the Markdown document.

[0057] Optionally, the conversion module is used to parse the nested structure of the value to determine multiple segmentation points;

[0058] The conversion module is used to segment the nested structure according to the multiple segmentation points to obtain multiple blocks;

[0059] The conversion module is used to determine a plurality of first screen blocks corresponding to the first screen content, and construct the element nodes for the first screen blocks;

[0060] The judgment module is used to determine the delayed blocks except the first screen block among the multiple blocks, and delay the construction of the element nodes for the delayed blocks according to the display order.

[0061] Optionally, the judgment module is used to determine the DOM structure of the DOM tree;

[0062] The judgment module is used to determine the nesting level supported by Markdown;

[0063] The conversion module is used to flatten the deep structure exceeding the nesting level in the DOM structure into flat list items, and use ordered and unordered lists to represent the hierarchical relationship of the deep structure.

[0064] In the third aspect of the present application, an electronic device is provided, including a processor, a memory, a user interface and a network interface, the memory is used to store instructions, the user interface and the network interface are both used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes any one of the methods described above.

[0065] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores instructions, and when the instructions are executed, any of the methods described above is executed.

[0066] In summary, one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:

[0067] 1. This application obtains the data content input by the user, automatically parses it into multiple data items, and then automatically processes different contents according to the type of data item. For data items of content type, by converting the text into the form of a DOM tree, the accurate expression of the complex structure is achieved, and based on the preset HTML and Markdown syntax mapping rules, the DOM tree can be automatically converted into a document that conforms to the Markdown format. The automation of this process does not require human intervention, so that the document can be efficiently converted into a format that the computer can understand, thereby greatly improving the efficiency of user manual generation and updating.

[0068] 2. This application analyzes the string through lexical parsing, decomposes it into multiple element nodes, and determines the type of each node based on the parsing results. This method not only helps to identify the semantic structure of the text, but also builds parent-child relationships based on node types to form a clear hierarchical structure. The final generated DOM tree lays the foundation for subsequent Markdown document conversion, allowing the text content to be presented in a more orderly and easy-to-understand form, improving the readability and maintainability of the user manual. Through this structured processing, users can manage and update content more efficiently while reducing errors caused by manual processing.

[0069] 3. Through segmented processing and delayed loading, the DOM tree construction process is optimized, especially when dealing with complex nested structures, avoiding the performance problem of building the entire page DOM tree at one time. By dividing the content into multiple parts, the first screen content is built first, and the rest is delayed loading, thereby improving system performance and user experience.

[0070] 4. By analyzing the structure of the DOM tree and determining the nesting levels supported by Markdown, the conversion of complex content can be effectively handled. During the conversion process, deep structures that exceed the Markdown nesting limit are flattened into flat list items, which not only preserves the hierarchical relationship of the original content, but also ensures the consistency and readability of the format of the generated Markdown document. Presenting deep content in the form of ordered and unordered lists can help users understand the organization of information more clearly, while reducing the format confusion that may be caused by Markdown syntax. Ultimately, this flexible conversion strategy not only improves the display effect of the user manual, but also enhances its adaptability and maintainability in different editing environments. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] Figure 1 It is a flowchart of a method for automatically generating a user manual by supporting online editing disclosed in an embodiment of the present application;

[0072] Figure 2 It is a logic diagram of a method for supporting online editing and automatically generating a user manual disclosed in an embodiment of the present application;

[0073] Figure 3 It is a module schematic diagram of a device for supporting online editing and automatic generation of a user manual disclosed in an embodiment of the present application;

[0074] Figure 4 It is a structural schematic diagram of an electronic device disclosed in an embodiment of the present application.

[0075] Explanation of the reference numerals: 301, acquisition module; 302, conversion module; 303, judgment module; 401, processor; 402, communication bus; 403, user interface; 404, network interface; 405, memory. DETAILED DESCRIPTION

[0076] In order to enable technicians in this field to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.

[0077] In the description of the embodiments of the present application, words such as "for example" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "for example" or "for example" is intended to present related concepts in a specific way.

[0078] In the description of the embodiments of the present application, the meaning of the term "multiple" refers to two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "include", "comprise", "have" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.

[0079] The fund manager service platform is a comprehensive operational support platform provided by financial institutions with asset custody or outsourcing qualifications to fund managers, helping fund managers simplify processes and ensure compliance and data security. The system user manual is its key resource, and professional financial scripts often need to be updated. The current process is that business personnel write Word documents, developers convert them to Markdown and manually deploy them online, but this method cannot achieve online editing and automatic updates, and is inefficient.

[0080] This embodiment discloses a method for supporting online editing and automatically generating a user manual. Figure 1 , including the following steps S110-S150:

[0081] S110, obtaining user input data content.

[0082] This application proposes a method and system that supports online editing and automatic generation of user manuals. The system provides a user-friendly web interface that allows users to easily manage manuals, including chapter creation, editing, and content modification. After the user saves the update, the system background will automatically generate the corresponding Markdown document for the edited content and display it through Docsify, without the need for manual intervention by developers, to achieve automatic updating and real-time display of the user manual.

[0083] The system adopts B / S architecture. Users access the platform through a Web browser to configure the user manual online. Users enter the user name, password and graphic verification code to log in to the system. After logging in, the user enters the configuration interface and can view the preview effects of all currently defined catalog chapters and contents. Catalog chapter management interface: edit catalog chapters or add new chapters. Chapter content management interface: select a chapter and edit its content, including the displayed title, paragraphs, pictures, etc.

[0084] Users input content through interfaces such as forms and rich text editors. It may be a complex input containing elements such as chapter titles, paragraphs, lists, tables, etc. For example, Chapter 1: Basic Knowledge of Fund Management. A fund is jointly funded by multiple investors and is mainly used to invest in various financial instruments.

[0085] S120, converting the data content into multiple data items.

[0086] When a user enters content in the system's interface (such as creating or editing a chapter or text in a user manual), the system needs to parse the input content first. Each piece of content (such as a title, a paragraph of text, a list, etc.) belongs to a specific content type.

[0087] Each input content needs to be converted into a data item, and each data item contains two key information: type: indicates the type of input content. For example, type can represent a title, paragraph, list, etc. value: represents the actual text or content, that is, the specific information entered by the user. Common type values ​​may include: title: used to represent the title of a chapter or paragraph; paragraph: used to represent the body or paragraph text; list: used to represent an ordered or unordered list; image: represents an image inserted by the user; link: represents hyperlink content; code: represents the written code block content.

[0088] Reference Figure 2, the system will process the data content (form array) entered by the user one by one, create corresponding data items, and save them as a set of structured data. If all the content has been processed, it will proceed to the next step; otherwise, it will continue to process the next one.

[0089] S130: Determine whether the type of the data item is a content type according to the type value.

[0090] In order to determine whether the type value of the data item is a content type, the system needs to perform a logical judgment based on the type field of the data item. This judgment is used to distinguish whether the content entered by the user is displayable content (such as title, text, list, etc.) or other auxiliary types (such as metadata, configuration, blank items, etc.).

[0091] First, we need to clearly define the content types in the system. In the user manual system, the content type usually refers to the specific information that will eventually be displayed in the user interface or document, including: title, paragraph, list, image, code block. These types of content are visible and interactive to users. Therefore, the system needs to be able to identify these types of data items.

[0092] The system will have a judgment process to identify whether a data item is a content type based on the type value. When the user saves the input, the system will parse each data item and get the type field from it. The system will check whether the type value of the current data item belongs to the content type based on a set of predefined content type lists. For example, the system can define the value of the content type as a set or array, and then use the type of the current data item to match the value in the set.

[0093] The system will use a simple judgment statement (such as if or switch statement) to check whether the type of the data item belongs to the content type. If so, the data item will be marked as "content type" and continue to be processed; if not, it will be skipped or other operations will be performed (such as processing metadata or configuration items).

[0094] S140: If it is determined that the type is a content type, convert the value into a DOM tree.

[0095] In a possible implementation, if the type is determined to be a content type, the value is converted into a DOM tree, specifically including: performing lexical analysis on the string contained in the value; generating multiple element nodes according to the result of the lexical analysis of the string; determining the node type of the element node according to the result of the lexical analysis of the string; constructing a parent-child node relationship of multiple element nodes according to the nested structure of the node type corresponding to the value; and constructing a tree model for the multiple element nodes according to the parent-child node relationship to obtain a DOM tree.

[0096] Specifically, lexical parsing is the starting point of the whole process, and its goal is to analyze the input value (string or text content entered by the user) word by word and divide them into basic language units (tokens). These tokens are the basis for building the DOM tree. The DOM (Document Object Model) tree is a tree model that represents the structure of an HTML or XML document. It represents each element, attribute, and content node in the document in the form of a hierarchy, allowing programming languages ​​(such as JavaScript) to access and manipulate these nodes. The DOM tree structures the HTML document into a hierarchical structure of parent-child relationships. Each HTML tag in the document (such as 、 、 etc.) are represented as a node in the tree. The top level is a root node (usually a label), and other labels are arranged in a hierarchy.

[0097] The value is scanned by a lexical analyzer, which analyzes each character and converts it into a meaningful lexical unit (token). For example, in HTML, <h1> title < / h1> Will be parsed into the following tokens: <h1> (start tag), title (text content),< / h1> (end tag). Similar parsing will also occur for Markdown. For example, #title will be parsed as: # (indicates the first-level title), title (text content). A series of tokens are generated based on the input content. These tokens are the basis for subsequent processing. Each token usually contains two pieces of information: type (tokentype), which identifies whether it is a tag, text, attribute, etc. Value (tokenvalue), the actual text content or tag name.

[0098] After lexical parsing, the generated tokens are converted into element nodes in the DOM tree. Each token corresponds to a node, and these nodes are gradually assembled into various parts of the DOM tree. First, the system initializes an empty DOM tree and waits for element nodes. Then the system creates corresponding DOM nodes based on the parsed token type and content. For example, if the token is a tag (such as <h1> ), the system will create a node of type h1. If the token is plain text (such as system overview), a text node will be created. Node structure: Each node usually contains: node type (such as HTML tags such as h1, p, div, etc.), node content (i.e. text or attribute value), and a list of child nodes (if there is a nested structure). For example, the corresponding< / h1> <h1> System Overview< / h1> , an h1 element node will be generated, containing the text node "System Overview".

[0099] After generating nodes, the system needs to determine the type of each node for subsequent operations. Based on the results of lexical parsing, tokens can be classified into different types of nodes, including label nodes, text nodes, attribute nodes, etc. The system will determine the type of each node based on the token generated by lexical parsing. For example: If the token is <h1> , the system will determine that this is a tag node. If the token is a system overview, the system will determine that this is a text node. The system maps different tags to corresponding DOM node types based on a set of predefined rules. For example:< / h1> <h1> It is mapped to the Heading node type in the DOM tree. The text content is mapped to the Text node type in the DOM tree. For example< / h1> <h1> System Overview< / h1> In <h1>is mapped to the Heading type, while the text content "System Overview" is mapped to the Text type. After determining the type of each node, the system needs to establish the parent-child relationship of these nodes based on the nested structure. The parent-child node relationship determines the structure and hierarchy of the entire DOM tree.

[0100] The start and end positions of tags have been identified during lexical parsing (such as< / h1> <h1> and< / h1> ), the system will build a nested structure based on this information. For example, if a tag contains other content, its content is treated as a child node. Based on the nested structure, the system will designate some nodes as parent nodes and other nodes as child nodes attached to the parent node. For example: <h1> System Overview< / h1> : The h1 tag is the parent node, and "System Overview" is its child node (text node).

[0101] After all element nodes are created and the parent-child relationship is built, the system organizes all nodes into a tree structure, namely the DOM tree. The DOM tree reflects the hierarchical relationship of the content of HTML or similar structures. The system will traverse all generated element nodes and insert the nodes into the DOM tree in sequence according to their parent-child relationship to form a tree hierarchy. Each node will be nested according to its position in the document. The outermost node is the root node, and the contained child nodes are recursively constructed. After completing the above steps, the DOM tree finally generated by the system reflects the hierarchical structure of the input content. The tree can be further operated, such as rendering into a web page, converting to other formats (such as Markdown), etc.

[0102] Furthermore, when converting the value of the content type into a DOM tree, if the content in the value is complex (such as nested HTML elements, dynamic data, non-standard tags, etc.), when converting it into a DOM tree, you may encounter the problem of too deep nesting. If the value contains a very deep nested structure, the process of parsing and building the DOM tree will become complicated, increasing the maintenance cost and processing difficulty of the code. Combining the methods of segmented processing and delayed loading can effectively solve the performance problems caused by too deep nesting.

[0103] In a possible implementation, after lexically parsing the string contained in the value, the method further includes: parsing the nested structure of the value to determine multiple segmentation points; dividing the nested structure according to the multiple segmentation points to obtain multiple blocks; determining multiple first-screen blocks corresponding to the first-screen content, and constructing element nodes for the first-screen blocks; determining delayed blocks other than the first-screen blocks among the multiple blocks, and delaying the construction of element nodes for the delayed blocks according to the display order.

[0104] Specifically, after lexical parsing of the value, a series of tokens are obtained. Next, the system needs to further analyze the nested structure of these tokens to determine the hierarchy and segmentation points of the content. The purpose of nested structure parsing is to lay the foundation for subsequent segmentation processing. After lexical parsing, the system scans the nested levels of these tokens to determine the start and end positions of each tag and content block. For HTML or similar structures, this usually means determining the start and end tags of child elements within each parent tag. The system analyzes the nesting depth of the content through recursive or depth-first search algorithms. For example, Contains multiple or <h1>, each level of nested relationships will be marked.

[0105] Segment points are boundaries used to divide content in nested structures. These segment points help divide the entire content block into multiple parts that can be processed independently. After the segment points are determined, the system can separate the content for lazy loading as needed. Segment points can be determined based on different rules, including: Tag type: such as h1, h2 title tags, or block-level tags such as div, section. Paragraph tags: such as A paragraph tag or Segmentation list. Content block size: If a content block is very large, the system can determine whether it needs to be further segmented based on the number of characters or lines. Segmentation point position marking: According to the above rules, the system marks each segmentation point in the token generated by lexical parsing and determines the start and end position of each segment.

[0106] After determining the segmentation points, the system will divide the original nested structure into multiple blocks based on these segmentation points. Each block represents an independent part of the content and can be processed separately. The system uses each segmentation point as a basis for segmentation to divide the nested structure into blocks. The size and number of blocks depend on the nesting depth of the content and the distribution of the segmentation points. Each block will be marked as an independent processing unit, recording its starting and ending positions and the parent node information to which it belongs. This allows the system to load these blocks on demand when needed. For example, for the previous content, the system may divide it into the following blocks: Title block: <h1> title< / h1> , Paragraph block 1: Paragraph 1 , Paragraph block 2: Paragraph 2 , list block: ... .

[0107] The first-screen content is what users see when they first load the page, usually the top content of the page. The system will prioritize processing and rendering of the first-screen blocks to ensure that users can see the content quickly. Based on the order of the blocks and the importance of the content, the system determines which blocks belong to the first-screen content. This usually includes the title of the page, the first paragraph of text, and other necessary information. The system will prioritize loading and building element nodes of these first-screen blocks to ensure that users can immediately see key content when the page is first rendered.

[0108] After determining the first-screen blocks, the system needs to build corresponding element nodes for these blocks and insert them into the DOM tree. This process is similar to the normal DOM tree construction, but the first-screen content is processed first. For each first-screen block, the system builds the corresponding DOM element node according to the previous lexical parsing results and parent-child node relationships. The system inserts these first-screen element nodes into the appropriate position of the DOM tree according to their nesting level to ensure that they can be displayed immediately on the user interface.

[0109] In addition to the above-the-fold content, the rest of the page content is divided into deferred chunks. These deferred chunks are loaded on demand based on the order of presentation, rather than all at once. The system marks chunks that are not above-the-fold as deferred chunks, such as content at the bottom of the page, extra paragraphs, or images. As the user scrolls or interacts with the page, the system progressively loads the content of these deferred chunks. Specific deferred loading strategies can be based on scroll position, visible area, or network conditions. When a deferred chunk needs to be displayed, the system constructs the corresponding element node and inserts it into the DOM tree. This process is similar to the construction of the above-the-fold chunk, but occurs after the user interacts with the page. Deferred chunks are loaded in a certain presentation order. Generally, the system determines the order in which the content is loaded based on its physical location in the page or the importance of the content. The system loads each deferred chunk in turn based on the page layout and the user's scrolling behavior, ensuring that the part the user scrolls to is loaded. As the user scrolls and the page presentation progresses, the DOM nodes of the deferred chunks are dynamically inserted into the DOM tree, allowing the content to be gradually displayed on the page.

[0110] The DOM tree construction process is optimized through segmented processing and delayed loading, especially when dealing with complex nested structures, avoiding the performance problem of building the entire page DOM tree at one time. By dividing the content into multiple parts, the first screen content is built first, and the rest is delayed loading, thereby improving system performance and user experience.

[0111] S150, converting the DOM tree into a Markdown document according to preset rules.

[0112] In a possible implementation, according to preset rules, converting a DOM tree into a Markdown document specifically includes: traversing each element node of the DOM tree by depth-first traversal or breadth-first traversal; converting each element node into Markdown syntax according to preset rules to obtain a first fragment, wherein the preset rules are mapping rules between HTML and Markdown syntax; escaping preset special elements in multiple element nodes to obtain a second fragment; and merging the first fragment and the second fragment to obtain a Markdown document.

[0113] Specifically, in the process of converting the DOM tree to a Markdown document, it is necessary to traverse each node in the DOM tree. Two traversal methods can be used: Depth-first traversal (DFS), which traverses child nodes first, enters the deepest child node first, and returns to the upper layer after processing. Breadth-first traversal (BFS), traverses layer by layer, from top to bottom, and processes all nodes in each layer in order. Generally, depth-first traversal is more suitable for processing DOM trees because it allows the deepest part of the nested structure to be processed first, and then gradually expands outward.

[0114] Start with the root node (such as or ) and recursively call each child node. For each node, determine its type (such as <h1>、 、 etc.) Recursively process the child elements of each node to ensure that the nested structure is completely traversed. In the depth-first traversal, the first , then enter <h1>and node until all child nodes have been processed.

[0115] When traversing the DOM tree, you need to use the preset HTML to Markdown mapping rules to convert each element into the corresponding Markdown syntax according to the tag type of each element. Each HTML tag has a corresponding Markdown syntax. For example: < / h1> <h1>Corresponds to # (first level title in Markdown), For normal text paragraphs, and Corresponding to unordered list (- or *), and Corresponding to ordered lists (1., 2., etc.)

[0116] For each traversed node, apply the mapping rule to convert it into the corresponding Markdown fragment. For example, <h1> title< / h1> will be converted to #title, and Paragraph content Will be directly converted to paragraph content.

[0117] In the DOM tree, some special elements or characters (such as <,>,&, etc.) cannot be used directly in Markdown and must be escaped to avoid syntax conflicts or content display errors. For some special characters (such as <,>,&, etc.), use escape symbols to process them. For example: < is escaped to <, > is escaped to >, and & is escaped to &. For some uncommon or complex HTML tags (such as <code>If you need to do additional processing, you can ensure that these tags can be displayed correctly in Markdown. If some nested structures are particularly complex (such as lists or tables containing other HTML elements), they also need to be escaped or specially processed during the conversion process to ensure that the display effect of the nested content is not destroyed.

[0118] During the traversal process, two types of fragments are generated: the first fragment is the regular Markdown text generated by traversing the DOM tree and applying the HTML to Markdown mapping rules. The second fragment is the processed Markdown fragment generated when processing special elements and character escapes. Finally, the first and second fragments are merged to ensure that the overall structure and content of the Markdown document are intact. During the merging process, it is necessary to ensure the correctness of the Markdown syntax. For example, the blank lines between titles and paragraphs, the format of lists, and other details should be consistent.

[0119] Furthermore, when converting a DOM tree to a Markdown document, although the conversion from rich text to a simplified text format can be achieved, the problem of too deep nesting levels may be encountered in the process. The DOM tree can support very complex nested structures, while the nesting level of Markdown is relatively limited, especially for structures such as lists and tables. Deeply nested HTML elements may not be mapped correctly when converted to Markdown. As a result, Markdown has limited support for nested lists, while in HTML, lists can be nested in complex ways. If the nesting level is too deep, Markdown may not accurately reflect the original DOM structure, resulting in confusing layout or content loss.

[0120] In a possible implementation, according to preset rules, the DOM tree is converted into a Markdown document, which specifically includes: determining the DOM structure of the DOM tree; determining the nesting level supported by Markdown; flattening the deep structure exceeding the nesting level in the DOM structure into flat list items, and using ordered and unordered lists to represent the hierarchical relationship of the deep structure.

[0121] Specifically, first, the structure of the DOM tree needs to be parsed. Traverse each node of the DOM tree, record its nesting level and node type (such as paragraph ,title <h1>, List During parsing, track the nesting depth of each node. The depth of the hierarchy can be recorded through recursion or stacking. For example, the root node has a depth of 0, the first-level child node has a depth of 1, and so on. Markdown's support for nested structures is limited. Usually, if the nested lists or other structures exceed 2-3 levels, the format will be confusing or difficult to read. Therefore, it is necessary to determine the maximum nesting level that Markdown can accept during implementation. Set a reasonable nesting depth threshold, such as 2 or 3 levels. Nested content exceeding this depth will be flattened. If the application scenario has higher requirements for the nesting depth, this threshold can be dynamically adjusted according to the capabilities of the Markdown renderer.

[0122] When it is determined that there are more nested levels in the DOM structure than Markdown supports, these deeply nested structures must be "flattened" and converted into flat list items. Each flattened level is represented by an ordered or unordered list to represent its hierarchical relationship. When it is found that the nested level exceeds the preset limit, all content below this level is regarded as flat list items. Use ordered (numbers 1., 2., 3.) or unordered (symbols -, *) list symbols to represent the hierarchical relationship of the original structure. Usually, shallower levels can be represented by unordered lists, and deeper levels can be represented by ordered lists.

[0123] The hierarchical relationship between different levels is indicated by mixing ordered lists and unordered lists. Ordered lists are often used to indicate deeper levels of nesting, while unordered lists are used for shallower structures. For shallower levels (such as level 1 and level 2), you can use the unordered list symbol - or * to represent them. These levels are often used to show the main structure of the list. For parts that exceed the nesting level supported by Markdown, use ordered lists 1., 2. to represent deeper levels. In this way, complex nesting can be avoided while still retaining the hierarchical information of the levels. After flattening and hierarchical identification are completed, the processed content is merged into a complete Markdown document. The document will show the hierarchical relationship in the original DOM structure in a clear format while avoiding the problem of too deep nesting.

[0124] In a possible implementation, after determining whether the type of the data item is a content type according to the type value, the method further includes: if the type is determined to be a title type, converting the value into a Markdown document according to the title level of the data item. Specifically, it includes: determining the title level of the data item; mapping the title level to the Markdown title; processing the value, placing the processed result after the Markdown title, and obtaining the Markdown document.

[0125] Specifically, in Markdown, the level of a title is usually indicated by the number of pound signs (#). Based on the data item's type value of "title type", its specific title level (such as first-level title, second-level title, etc.) needs to be further determined. Each title type data item usually contains an additional field to indicate the level of the title. For example, this field may be stored as numbers 1, 2, 3, etc., representing first-level title, second-level title, third-level title, etc., respectively. Extract the value of this field (such as header_level) from the data item, which will serve as an important basis for mapping to Markdown syntax in subsequent steps.

[0126] Reference Figure 2 , Markdown uses # to indicate the hierarchy of titles, and the hierarchy from the first-level title to the sixth-level title is # to ######. Next, you need to convert it into the corresponding Markdown title format based on the extracted header_level. According to header_level, determine how many pound signs (#) need to be added in the Markdown document. First-level title: #, second-level title: ##, third-level title: ###, and so on, up to the sixth-level title (######). According to the determined title level, add the corresponding number of pound signs before the content of the title, and add a space symbol after the pound sign to ensure that the Markdown format is correct.

[0127] The value represents the actual text content in the data item, that is, the specific text of the title. When constructing a Markdown document, you need to combine this value with the Markdown title format. Make sure that the text in the value does not have extra spaces or invisible characters to avoid affecting the display effect of the Markdown format. Insert the processed value after the space after the pound sign. This is the main content of the title, and the Markdown renderer will display it as the title text in the document. Integrate the mapped Markdown title and the corresponding value content and output them as part of the Markdown document.

[0128] This embodiment also discloses a device that supports online editing and automatically generates a user manual. Figure 3 The device includes an acquisition module 301, a conversion module 302 and a judgment module 303, wherein:

[0129] The acquisition module 301 is used to acquire the data content input by the user.

[0130] The conversion module 302 is used to convert the data content into multiple data items, where the data items include type values ​​and value values.

[0131] The judgment module 303 is used to judge whether the type of the data item is a content type according to the type value.

[0132] The conversion module 302 is used to convert the value into a DOM tree if it is determined that the type is a content type.

[0133] The conversion module 302 is used to convert the DOM tree into a Markdown document according to preset rules.

[0134] In a possible implementation, the conversion module 302 is used to convert the value into a Markdown document according to the title level of the data item if it is determined that the type is a title type.

[0135] In a possible implementation, the conversion module 302 is used to perform lexical analysis on the character string contained in the value.

[0136] The conversion module 302 is used to generate multiple element nodes according to the result of lexical analysis of the character string.

[0137] The judgment module 303 is used to determine the node type of the element node according to the result of the lexical analysis of the character string.

[0138] The conversion module 302 is used to construct the parent-child node relationship of multiple element nodes according to the nested structure of the value corresponding to the node type.

[0139] The conversion module 302 is used to construct a tree model for multiple element nodes according to the parent-child node relationship to obtain a DOM tree.

[0140] In a possible implementation, the acquisition module 301 is configured to traverse each element node of the DOM tree by depth-first traversal or breadth-first traversal.

[0141] The conversion module 302 is used to convert each element node into Markdown syntax according to a preset rule to obtain a first segment, wherein the preset rule is a mapping rule between HTML and Markdown syntax.

[0142] The conversion module 302 is used to escape the preset special elements in the multiple element nodes to obtain a second segment.

[0143] The conversion module 302 is used to merge the first segment and the second segment to obtain a Markdown document.

[0144] In a possible implementation, the determination module 303 is used to determine the title level of the data item.

[0145] The conversion module 302 is used to map the heading levels to the Markdown headings.

[0146] The conversion module 302 is used to process the value and place the processed result after the Markdown title to obtain a Markdown document.

[0147] In a possible implementation, the conversion module 302 is used to parse the nested structure of the value to determine multiple segmentation points.

[0148] The conversion module 302 is used to segment the nested structure according to multiple segmentation points to obtain multiple blocks.

[0149] The conversion module 302 is used to determine multiple first-screen blocks corresponding to the first-screen content, and construct element nodes for the first-screen blocks.

[0150] The judgment module 303 is used to determine the delayed blocks except the first screen block among the multiple blocks, and delay the construction of element nodes for the delayed blocks according to the display order.

[0151] In a possible implementation, the determination module 303 is used to determine the DOM structure of the DOM tree.

[0152] The judgment module 303 is used to determine the nesting level supported by Markdown.

[0153] The conversion module 302 is used to flatten the deep structure exceeding the nesting level in the DOM structure into flat list items, and use ordered and unordered lists to represent the hierarchical relationship of the deep structure.

[0154] It should be noted that: when the device provided in the above embodiment realizes its function, only the division of the above functional modules is used as an example. In actual application, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0155] This embodiment also discloses an electronic device, referring to Figure 4 The electronic device may include: at least one processor 401 , at least one communication bus 402 , a user interface 403 , a network interface 404 , and at least one memory 405 .

[0156] The communication bus 402 is used to realize the connection and communication between these components.

[0157] The user interface 403 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 403 may also include a standard wired interface and a wireless interface.

[0158] The network interface 404 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).

[0159] Among them, the processor 401 may include one or more processing cores. The processor 401 uses various interfaces and lines to connect various parts in the entire server, and executes various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 405, and calling data stored in the memory 405. Optionally, the processor 401 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 401 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 401, and it can be implemented separately through a chip.

[0160] Among them, the memory 405 may include a random access memory (RAM) or a read-only memory (Read-Only Memory). Optionally, the memory includes a non-transitory computer-readable storage medium. The memory 405 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 405 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 405 may also be at least one storage device located away from the aforementioned processor 401. The memory 405 as a computer storage medium may include an operating system, a network communication module, a user interface 403 module, and an application supporting a method for automatically generating a user manual by online editing.

[0161] exist Figure 4 In the electronic device shown, the user interface 403 is mainly used to provide an input interface for the user and obtain data input by the user; and the processor 401 can be used to call an application stored in the memory 405 that supports a method for automatically generating a user manual through online editing. When executed by one or more processors 401, the electronic device executes one or more methods in the above-mentioned embodiments.

[0162] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for the present application.

[0163] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0164] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0165] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0166] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0167] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory 405, including a number of instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned memory 405 includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk.

[0168] The present application also discloses a computer-readable storage medium, wherein the computer-readable storage medium stores instructions. When executed by one or more processors 401, the electronic device executes one or more of the methods described in the above embodiments.

[0169] The above is only an exemplary embodiment of the present disclosure, and the scope of the present disclosure cannot be limited thereto. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the disclosure of the specification and the truth of practice, it will be easy for those skilled in the art to think of other embodiments of the present disclosure. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the technical field that are not recorded in the present disclosure. The description and examples are regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims. < / h1> < / code> 、 < / h1> < / h1> < / h1>

Claims

1. A method for automatically generating a user manual by supporting online editing, characterized in that: The method comprises: Get the user input data content; Convert the data content into multiple data items, each of which includes a type value and a value value; Determine whether the type of the data item is a content type according to the type value; If it is determined that the type is a content type, convert the value into a DOM tree; According to preset rules, convert the DOM tree into a Markdown document; If it is determined that the type is a content type, converting the value into a DOM tree specifically includes: Perform lexical analysis on the string contained in the value; Generate multiple element nodes according to the result of lexical analysis of the string; Determine the node type of the element node according to the result of lexical analysis of the string; Constructing a parent-child node relationship of multiple element nodes according to the nested structure of the value corresponding to the node type; Constructing a tree model for the plurality of element nodes according to the parent-child node relationship to obtain the DOM tree; After performing lexical analysis on the character string contained in the value, the method further includes: Parse the nested structure of the value to determine multiple segmentation points; According to the plurality of segmentation points, the nested structure is segmented to obtain a plurality of blocks; Determine a plurality of first screen blocks corresponding to the first screen content, and construct the element nodes for the first screen blocks; Determine delayed blocks except the first screen block among the multiple blocks, and delay the delayed blocks to construct the element nodes according to the display order; The step of converting the DOM tree into a Markdown document according to a preset rule specifically includes: Determine the DOM structure of the DOM tree; Determine the nesting level supported by Markdown; The deep structure exceeding the nesting level in the DOM structure is flattened into flat list items, and ordered and unordered lists are used to represent the hierarchical relationship of the deep structure.

2. A method for supporting online editing and automatically generating a user manual according to claim 1, characterized in that: After determining whether the type of the data item is a content type according to the type value, the method further includes: If it is determined that the type is a title type, the value is converted into a Markdown document according to the title level of the data item.

3. The method for supporting online editing and automatically generating a user manual according to claim 1, characterized in that: The step of converting the DOM tree into a Markdown document according to a preset rule specifically includes: Traverse each element node of the DOM tree by depth-first traversal or breadth-first traversal; According to a preset rule, each of the element nodes is converted into Markdown syntax to obtain a first fragment, wherein the preset rule is a mapping rule between HTML and Markdown syntax; Escaping the preset special elements in the plurality of element nodes to obtain a second fragment; The first segment and the second segment are merged to obtain the Markdown document.

4. The method for supporting online editing and automatically generating a user manual according to claim 2, characterized in that: If it is determined that the type is a title type, then according to the title level of the data item, the value is converted into a Markdown document, specifically including: determining a heading level for the data item; Map said heading levels to Markdown headings; The value is processed, and the processed result is placed after the Markdown title to obtain the Markdown document.

5. A device that supports online editing and automatic generation of user manuals, characterized in that: The device comprises an acquisition module (301), a conversion module (302) and a judgment module (303), wherein: The acquisition module (301) is used to acquire the data content input by the user; The conversion module (302) is used to convert the data content into multiple data items, wherein the data items include type values ​​and value values; The judging module (303) is used to judge whether the type of the data item is a content type according to the type value; The conversion module (302) is used to convert the value into a DOM tree if it is determined that the type is a content type; The conversion module (302) is used to convert the DOM tree into a Markdown document according to a preset rule; The judgment module (303) is used to perform lexical analysis on the character string contained in the value; The conversion module (302) is used to generate a plurality of element nodes according to the result of lexical analysis of the character string; The judgment module (303) is used to determine the node type of the element node according to the result of the lexical analysis of the character string; The conversion module (302) is used to construct a parent-child node relationship of a plurality of the element nodes according to the nested structure of the value corresponding to the node type; The conversion module (302) is used to construct a tree model for the plurality of element nodes according to the parent-child node relationship to obtain the DOM tree; The judgment module (303) is used to parse the nested structure of the value and determine multiple segmentation points; The conversion module (302) is used to segment the nested structure according to the plurality of segmentation points to obtain a plurality of blocks; The conversion module (302) is used to determine a plurality of first screen blocks corresponding to the first screen content, and construct the element nodes for the first screen blocks; The judgment module (303) is used to determine the delayed blocks except the first screen block among the multiple blocks, and delay the delayed blocks to construct the element nodes according to the display order; The determination module (303) is used to determine the DOM structure of the DOM tree; The determination module (303) is used to determine the nesting level supported by Markdown; The conversion module (302) is used to flatten the deep structure exceeding the nesting level in the DOM structure into flat list items, and use ordered and unordered lists to represent the hierarchical relationship of the deep structure.

6. An electronic device, characterized in that: The electronic device comprises a processor (401), a communication bus (402), a user interface (403), a network interface (404) and a memory (405), wherein the memory (405) is used to store instructions, the user interface (403) and the network interface (404) are both used to communicate with other devices, the communication bus (402) is used to realize connection and communication between components in the electronic device, and the processor (401) is used to execute the instructions stored in the memory (405) so that the electronic device executes the method according to any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 4 is performed.

Citation Information

Patent Citations

  • Webpage splitting method

    CN102073710A

  • Rich text data processing method and device, electronic equipment and computer storage medium

    CN111274760A

  • Webpage generation method and device, electronic equipment and storage medium

    CN112527291A