CN113792531A - Markdown grammar extension-based text editing method and system - Google Patents

Markdown grammar extension-based text editing method and system Download PDF

Info

Publication number
CN113792531A
CN113792531A CN202110943107.XA CN202110943107A CN113792531A CN 113792531 A CN113792531 A CN 113792531A CN 202110943107 A CN202110943107 A CN 202110943107A CN 113792531 A CN113792531 A CN 113792531A
Authority
CN
China
Prior art keywords
markdown
text
user
rule
grammar
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110943107.XA
Other languages
Chinese (zh)
Other versions
CN113792531B (en
Inventor
林超群
李仁杰
张翔
王彪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Lop Xiamen System Integration Co ltd
Ropt Technology Group Co ltd
Original Assignee
Lop Xiamen System Integration Co ltd
Ropt Technology Group Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Lop Xiamen System Integration Co ltd, Ropt Technology Group Co ltd filed Critical Lop Xiamen System Integration Co ltd
Priority to CN202110943107.XA priority Critical patent/CN113792531B/en
Publication of CN113792531A publication Critical patent/CN113792531A/en
Application granted granted Critical
Publication of CN113792531B publication Critical patent/CN113792531B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation
    • G06F40/16Automatic learning of transformation rules, e.g. from examples
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing

Abstract

The invention provides a text editing method and system based on markdown grammar expansion, which comprises the steps of reading a markdown text file uploaded by a user, and converting the markdown text file into a markdown plain text; correspondingly generating a grammar rule for processing the markdown plain text according to a rule configured by a user, and analyzing the markdown plain text according to the grammar rule; writing css according to a pattern configured by a user in a self-defined mode, storing the pattern in a css mode, and loading the css to a header of html when analyzing the markdown plain text so as to configure the grammar rule; and analyzing the markdown plain text in a mode of operating rules one by one, and converting the analyzed text into an html text. The invention can realize the personalized extension of grammar, realize the personalized style configuration of the text analyzed by the editor, and solve the problem of pause when reading large markdown text by a paging asynchronous analysis method.

Description

Markdown grammar extension-based text editing method and system
Technical Field
The invention relates to the technical field of software engineering, in particular to a text editing method and system based on markdown grammar extension.
Background
Markdown is a lightweight markup language that allows people to compose documents using a plain text format that is easy to read and write. It has a set of fixed grammar rules. It is difficult to write a more personalized document in Markdown language.
At present, a plurality of markdown editors and readers are available on the market, but the following problems exist:
1. lack of functionality for personalized grammar configuration;
2. meanwhile, the ability of personalized configuration of reader styles is lacked;
3. the problem of very unsmooth reading of large markdown texts.
Disclosure of Invention
The invention provides a text editing method and system based on markdown grammar extension, which aim to overcome the defects of the prior art.
In one aspect, the present invention provides a method for editing a text based on markdown syntax extension, the method comprising the following steps:
s1: reading a markdown text file uploaded by a user, and converting the markdown text file into a markdown plain text;
s2: according to rules configured by a user in a self-defined manner and rules of a product used at present, generating a grammar rule for processing the markdown plain text correspondingly by utilizing each rule, and compiling each grammar rule with a corresponding function to generate a corresponding function for analyzing the markdown plain text by utilizing the grammar rule when the function is operated;
s3: writing css according to a user-defined configuration pattern, storing the pattern in a css mode, and loading the css to a header head of html to realize configuration of the grammar rule when analyzing the markdown plain text, wherein the pattern is defined by a user according to the user-defined configuration rule;
s4: and analyzing the markdown plain text in sequence based on the grammar rule corresponding to the function in a mode of operating the functions one by one, obtaining an analyzed text after operating all the functions, and converting the analyzed text into an html text.
The method reads the markdown text, analyzes the modified text by the chain analysis algorithm according to the self-defined grammar rule and the rule by rule, converts the modified text into the html text which can be read by the browser, and loads the user-defined style at the same time, thereby finally realizing grammar expansion and style personalized configuration.
In a specific embodiment, the api of the filereader is used when reading the markdown text file uploaded by the user.
In a particular embodiment, the style specifically includes a grammar extension and a style personalization.
In a specific embodiment, before the markdown plain text is sequentially analyzed based on the grammar rule corresponding to the function by operating the functions one by one, paging the markdown plain text is further performed, and the specific steps include:
sequentially reading L lines of texts in the markdown plain text, taking the L lines of texts as a page of text to be analyzed after each L line of texts is read, executing the step in S4 on the page of text to be analyzed, and reading the next L lines of texts;
and L is the number of lines occupied by each page of text to be analyzed, and L is the screen height/the fixed occupied height of each line. The method for asynchronously analyzing the text by paging avoids the problem of jamming caused by analyzing all markdowns at one time.
In a specific embodiment, when the user jumps to the nth to-be-analyzed text during reading the markdown plain text, the step in S4 is performed on the nth to-be-analyzed text, where the nth to-be-analyzed text is specifically the text from the (N-1) th line to the nth line in the markdown plain text.
In a specific embodiment, the S4 further includes:
when the function which is currently operated is found to be abnormal during analysis, the rule which is configured by the user self-definition and corresponds to the function is positioned and fed back, and meanwhile, the function which is abnormal is skipped to continuously operate the next function. When any rule is abnormal, the user can skip the rule, continue to analyze downwards and prompt the user that a certain custom rule is abnormal in writing.
Through the chain analysis of the S4, any rule can be formed by combining any plurality of sub-rules in a chain mode, and therefore the rule expandability is improved; a plurality of rules can be combined and sequenced with each other, so that a special translation effect is achieved; when a user customizes the rule, if the rule is wrongly written, the chain analysis can accurately position the rule with the exception, so that the application of other rules is not influenced, and the fault tolerance of the product is improved.
In a specific embodiment, the user-defined rule includes a plurality of sub-rules, and the plurality of sub-rules are used to be executed in sequence when the function is executed.
In a specific embodiment, the method is used in a markdown reader to facilitate reading.
According to a second aspect of the present invention, a computer-readable storage medium is proposed, on which a computer program is stored, which computer program, when being executed by a computer processor, carries out the above-mentioned method.
According to a third aspect of the present invention, a text editing system based on markdown syntax extension is provided, the system comprising:
a markdown text reading module: the method comprises the steps that a markdown text file uploaded by a user is configured to be read, and the markdown text file is converted into a markdown plain text;
a self-defined grammar rule module: configuring rules used for self-defining configuration according to a user and rules of a product used at present, correspondingly generating a grammar rule used for processing the markdown plain text by using each rule, and then writing functions corresponding to the grammar rule to generate corresponding functions for analyzing the markdown plain text by using the grammar rule when the functions are operated;
a custom style module: the method comprises the steps that the configuration is used for compiling cs according to a user-defined configuration pattern, the pattern is stored in the cs mode, when the markdown plain text is analyzed, the cs is loaded to a header head of html so as to realize the configuration of grammar rules, and the pattern is defined by a user according to the user-defined configuration rules;
a chain analysis module: and the method is configured to analyze the markdown plain text in sequence based on the grammar rules corresponding to the functions in a mode of operating the functions one by one, obtain an analyzed text after operating all the functions, and convert the analyzed text into an html text.
The method comprises the steps of reading a markdown text file uploaded by a user, and converting the markdown text file into a markdown plain text; according to rules configured by a user in a self-defined manner and rules of a product used at present, generating a grammar rule for processing the markdown plain text correspondingly by utilizing each rule, and compiling each grammar rule with a corresponding function to generate a corresponding function for analyzing the markdown plain text by utilizing the grammar rule when the function is operated; writing css according to a user-defined configuration pattern, storing the pattern in a css mode, and loading the css to a header head of html to realize configuration of the grammar rule when analyzing the markdown plain text, wherein the pattern is defined by a user according to the user-defined configuration rule; and analyzing the markdown plain text in sequence based on the grammar rule corresponding to the function in a mode of operating the functions one by one, obtaining an analyzed text after operating all the functions, and converting the analyzed text into an html text. The invention can realize the personalized extension of grammar, can read and edit markdown texts aiming at the grammar, realizes the personalized style configuration of the texts analyzed by an editor, and solves the problem of very unsmooth reading of large markdown texts by a paging asynchronous analysis method.
Drawings
The accompanying drawings are included to provide a further understanding of the embodiments and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments and together with the description serve to explain the principles of the invention. Other embodiments and many of the intended advantages of embodiments will be readily appreciated as they become better understood by reference to the following detailed description. Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a flow diagram of a text editing method based on markdown syntax extension according to an embodiment of the present invention;
FIG. 3 is a block diagram of a text editing system based on markdown syntax extensions according to an embodiment of the present invention;
FIG. 4 is a block diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 shows an exemplary system architecture 100 to which a markdown syntax extension-based text editing method according to an embodiment of the present application may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. Various applications, such as a data processing application, a data visualization application, a web browser application, etc., may be installed on the terminal devices 101, 102, 103.
The terminal apparatuses 101, 102, and 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices including, but not limited to, smart phones, tablet computers, laptop portable computers, desktop computers, and the like. When the terminal apparatuses 101, 102, 103 are software, they can be installed in the electronic apparatuses listed above. It may be implemented as multiple pieces of software or software modules (e.g., software or software modules used to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
The server 105 may be a server that provides various services, such as a background information processing server that provides support for markdown text files presented on the terminal apparatuses 101, 102, 103. The background information processing server may process the acquired markdown plain text and generate a processing result (e.g., html text).
It should be noted that the method provided in the embodiment of the present application may be executed by the server 105, or may be executed by the terminal devices 101, 102, and 103, and the corresponding apparatus is generally disposed in the server 105, or may be disposed in the terminal devices 101, 102, and 103.
The server may be hardware or software. When the server is hardware, it may be implemented as a distributed server cluster formed by multiple servers, or may be implemented as a single server. When the server is software, it may be implemented as multiple pieces of software or software modules (e.g., software or software modules used to provide distributed services), or as a single piece of software or software module. And is not particularly limited herein.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Fig. 2 is a flowchart illustrating a text editing method based on markdown syntax extension according to an embodiment of the present invention. As shown in fig. 2, the method comprises the steps of:
s201: reading a markdown text file uploaded by a user, and converting the markdown text file into a markdown plain text.
In a specific embodiment, the api of the filereader is used when reading the markdown text file uploaded by the user.
S202: and correspondingly generating a grammar rule for processing the markdown plain text by utilizing each rule according to the rule configured by the user and the rule carried by the product used at present, and compiling each grammar rule with the function corresponding to the grammar rule to generate a corresponding function for analyzing the markdown plain text by utilizing the grammar rule when the function is operated.
In a specific embodiment, the user-defined rule includes a plurality of sub-rules, and the plurality of sub-rules are used to be executed in sequence when the function is executed.
In a specific embodiment, the following function (denoted F) is used as a carrier of the grammar rules, where T denotes markdown plain text generated in S201:
function F(T){
1. matching according to grammatical rules
2. Conversion to target text T0
3. Return converted text TO
}
The function F is specifically described below by way of example:
if the user defines a grammar rule F0, matching ([ B ] arbitrary markwon text) in the markdown grammar, which indicates that text beginning with [ B ] as a line is uniformly converted into bold font < B > arbitrary markwon text. Then the grammar rule F0 corresponds to the writing of the function F0 as follows:
Figure BDA0003215868390000071
it should be appreciated that these rules can be custom configured by the user, or can be obtained by loading off-the-shelf rules.
S203: and compiling cs according to a user-defined configuration pattern, storing the pattern in the cs, and loading the cs to a header of html (hypertext markup language) when analyzing the markdown plain text so as to configure the grammar rule, wherein the pattern is defined by a user according to the user-defined configuration rule.
In a particular embodiment, the style specifically includes a grammar extension and a style personalization.
S204: and analyzing the markdown plain text in sequence based on the grammar rule corresponding to the function in a mode of operating the functions one by one, obtaining an analyzed text after operating all the functions, and converting the analyzed text into an html text.
The following illustrates the chain analysis in step S204:
for example, the existing product has its own rules F1, F2, F3 and user-defined rules Fa, Fb, Fc, then the parsing method is as follows:
t ═ markdwon plain text'
R=F1(T)
R=F2(R)
R=F3(R)
R=Fa(R)
R=Fb(R)
R=Fc(R)
……
And after the analysis is finished, R is the text after the final analysis.
In a specific embodiment, before the markdown plain text is sequentially analyzed based on the grammar rule corresponding to the function by operating the functions one by one, paging the markdown plain text is further performed, and the specific steps include:
sequentially reading L lines of texts in the markdown plain text, taking the L lines of texts as a page of text to be analyzed after each L line of texts is read, executing the step in S4 on the page of text to be analyzed, and reading the next L lines of texts;
and L is the number of lines occupied by each page of text to be analyzed, and L is the screen height/the fixed occupied height of each line.
In a specific embodiment, when the user jumps to the nth to-be-analyzed text during reading the markdown plain text, the step in S4 is performed on the nth to-be-analyzed text, where the nth to-be-analyzed text is specifically the text from the (N-1) th line to the nth line in the markdown plain text.
In a specific embodiment, the S204 further includes:
when the function which is currently operated is found to be abnormal during analysis, the rule which is configured by the user self-definition and corresponds to the function is positioned and fed back, and meanwhile, the function which is abnormal is skipped to continuously operate the next function.
In a specific embodiment, the method is used in a markdown reader to facilitate reading.
Fig. 3 shows a block diagram of a text editing system based on markdown syntax extension according to an embodiment of the present invention. The system comprises a markdown text reading module 301, a custom grammar rule module 302, a custom style module 303 and a chain analysis module 304.
In a specific embodiment, the markdown text reading module 301 is configured to read a markdown text file uploaded by a user, and convert the markdown text file into a markdown plain text;
the user-defined grammar rule module 302 is configured to generate a grammar rule for processing the markdown plain text correspondingly according to a rule configured by a user through user definition and a rule of the product used at present, and then perform corresponding function writing on each grammar rule to generate a corresponding function, and analyze the markdown plain text by using the grammar rule when the function is operated;
the custom style module 303 is configured to write css according to a style configured by a user in a custom manner, store the style in the css manner, and load the css to a header of html to implement configuration of the grammar rule when the markdown plain text is analyzed, where the style is defined by the user according to the rule configured by the user in the custom manner;
the chain analysis module 304 is configured to analyze the markdown plain text in sequence based on the grammar rule corresponding to the function by operating the function one by one, obtain an analyzed text after all the functions are operated, and convert the analyzed text into an html text.
The system reads the markdown text, analyzes the changed text by rule according to the grammar rule of the user-defined configuration, converts the changed text into the html text which can be read by a browser, loads the user-defined style at the same time, finally realizes grammar expansion and style personalized configuration, and solves the problem of very unsmooth reading of the large markdown text by a paging asynchronous analysis method.
Referring now to FIG. 4, shown is a block diagram of a computer system 400 suitable for use in implementing the electronic device of an embodiment of the present application. The electronic device shown in fig. 4 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 4, the computer system 400 includes a Central Processing Unit (CPU)401 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)402 or a program loaded from a storage section 408 into a Random Access Memory (RAM) 403. In the RAM 403, various programs and data necessary for the operation of the system 400 are also stored. The CPU 401, ROM 402, and RAM 403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
The following components are connected to the I/O interface 405: an input section 406 including a keyboard, a mouse, and the like; an output section 407 including a display such as a Liquid Crystal Display (LCD) and a speaker; a storage section 408 including a hard disk and the like; and a communication section 409 including a network interface card such as a LAN card, a modem, or the like. The communication section 409 performs communication processing via a network such as the internet. A driver 410 is also connected to the I/O interface 405 as needed. A removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 410 as necessary, so that a computer program read out therefrom is mounted into the storage section 408 as necessary.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 409, and/or installed from the removable medium 411. The computer program performs the above-described functions defined in the method of the present application when executed by a Central Processing Unit (CPU) 401. It should be noted that the computer readable storage medium described herein can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable storage medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable storage medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present application may be implemented by software or hardware. The units described may also be provided in a processor, and the names of the units do not in some cases constitute a limitation of the unit itself.
Embodiments of the present invention also relate to a computer-readable storage medium having stored thereon a computer program which, when executed by a computer processor, implements the method above. The computer program comprises program code for performing the method illustrated in the flow chart. It should be noted that the computer readable medium of the present application can be a computer readable signal medium or a computer readable medium or any combination of the two.
The method comprises the steps of reading a markdown text file uploaded by a user, and converting the markdown text file into a markdown plain text; according to rules configured by a user in a self-defined manner and rules of a product used at present, generating a grammar rule for processing the markdown plain text correspondingly by utilizing each rule, and compiling each grammar rule with a corresponding function to generate a corresponding function for analyzing the markdown plain text by utilizing the grammar rule when the function is operated; writing css according to a user-defined configuration pattern, storing the pattern in a css mode, and loading the css to a header head of html to realize configuration of the grammar rule when analyzing the markdown plain text, wherein the pattern is defined by a user according to the user-defined configuration rule; and analyzing the markdown plain text in sequence based on the grammar rule corresponding to the function in a mode of operating the functions one by one, obtaining an analyzed text after operating all the functions, and converting the analyzed text into an html text. The invention can realize the personalized extension of grammar, can read and edit markdown texts aiming at the grammar, realizes the personalized style configuration of the texts analyzed by an editor, and solves the problem of very unsmooth reading of large markdown texts by a paging asynchronous analysis method.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the invention. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (10)

1. A text editing method based on markdown grammar extension is characterized by comprising the following steps:
s1: reading a markdown text file uploaded by a user, and converting the markdown text file into a markdown plain text;
s2: according to rules configured by a user in a self-defined manner and rules of a product used at present, generating a grammar rule for processing the markdown plain text correspondingly by utilizing each rule, and compiling each grammar rule with a corresponding function to generate a corresponding function for analyzing the markdown plain text by utilizing the grammar rule when the function is operated;
s3: writing css according to a user-defined configuration pattern, storing the pattern in a css mode, and loading the css to a header head of html to realize configuration of the grammar rule when analyzing the markdown plain text, wherein the pattern is defined by a user according to the user-defined configuration rule;
s4: and analyzing the markdown plain text in sequence based on the grammar rule corresponding to the function in a mode of operating the functions one by one, obtaining an analyzed text after operating all the functions, and converting the analyzed text into an html text.
2. The method of claim 1, wherein the api of filereader is used when reading a markdown text file uploaded by a user.
3. The method according to claim 1, characterized in that the styles in particular comprise grammar extension and style personalization.
4. The method according to claim 1, wherein before the markdown plain text is sequentially parsed based on the grammar rule corresponding to the function by operating the function one by one, paging the markdown plain text is further performed, and the specific steps include:
sequentially reading L lines of texts in the markdown plain text, taking the L lines of texts as a page of text to be analyzed after each L line of texts is read, executing the step in S4 on the page of text to be analyzed, and reading the next L lines of texts;
and L is the number of lines occupied by each page of text to be analyzed, and L is the screen height/the fixed occupied height of each line.
5. The method according to claim 4, wherein the step of S4 is performed for the Nth text to be parsed when a user jumps to the Nth text to be parsed during reading of the markdown plain text, wherein the Nth text to be parsed is specifically the (N-1) × L to Nth L lines of the markdown plain text.
6. The method according to claim 1, wherein the S4 further comprises:
when the function which is currently operated is found to be abnormal during analysis, the rule which is configured by the user self-definition and corresponds to the function is positioned and fed back, and meanwhile, the function which is abnormal is skipped to continuously operate the next function.
7. The method of claim 1, wherein the user-custom configured rule comprises a plurality of sub-rules, and wherein the plurality of sub-rules are used to be executed in sequence when the function is executed.
8. The method of claim 1, wherein the method is used in a markdown reader to facilitate reading.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a computer processor, carries out the method of any one of claims 1 to 8.
10. A text editing system based on markdown grammar extension, comprising:
a markdown text reading module: the method comprises the steps that a markdown text file uploaded by a user is configured to be read, and the markdown text file is converted into a markdown plain text;
a self-defined grammar rule module: configuring rules used for self-defining configuration according to a user and rules of a product used at present, correspondingly generating a grammar rule used for processing the markdown plain text by using each rule, and then writing functions corresponding to the grammar rule to generate corresponding functions for analyzing the markdown plain text by using the grammar rule when the functions are operated;
a custom style module: the method comprises the steps that the configuration is used for compiling cs according to a user-defined configuration pattern, the pattern is stored in the cs mode, when the markdown plain text is analyzed, the cs is loaded to a header head of html so as to realize the configuration of grammar rules, and the pattern is defined by a user according to the user-defined configuration rules;
a chain analysis module: and the method is configured to analyze the markdown plain text in sequence based on the grammar rules corresponding to the functions in a mode of operating the functions one by one, obtain an analyzed text after operating all the functions, and convert the analyzed text into an html text.
CN202110943107.XA 2021-08-17 2021-08-17 Text editing method and system based on markdown grammar expansion Active CN113792531B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110943107.XA CN113792531B (en) 2021-08-17 2021-08-17 Text editing method and system based on markdown grammar expansion

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110943107.XA CN113792531B (en) 2021-08-17 2021-08-17 Text editing method and system based on markdown grammar expansion

Publications (2)

Publication Number Publication Date
CN113792531A true CN113792531A (en) 2021-12-14
CN113792531B CN113792531B (en) 2024-02-27

Family

ID=78876043

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110943107.XA Active CN113792531B (en) 2021-08-17 2021-08-17 Text editing method and system based on markdown grammar expansion

Country Status (1)

Country Link
CN (1) CN113792531B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019214539A1 (en) * 2018-05-08 2019-11-14 阿里巴巴集团控股有限公司 Document display method and apparatus
CN110532525A (en) * 2019-07-18 2019-12-03 深圳点猫科技有限公司 A kind of method and device automatically generating handout based on web technology
US20210004209A1 (en) * 2019-07-02 2021-01-07 Brian Holt Hyperpiler

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019214539A1 (en) * 2018-05-08 2019-11-14 阿里巴巴集团控股有限公司 Document display method and apparatus
US20210004209A1 (en) * 2019-07-02 2021-01-07 Brian Holt Hyperpiler
CN110532525A (en) * 2019-07-18 2019-12-03 深圳点猫科技有限公司 A kind of method and device automatically generating handout based on web technology

Also Published As

Publication number Publication date
CN113792531B (en) 2024-02-27

Similar Documents

Publication Publication Date Title
CN109933752B (en) Method and device for exporting electronic document
US10067856B2 (en) Employing code overlays to facilitate software development
CN106294493B (en) Method and device for realizing document format conversion
US10839040B2 (en) Normalizing a page flow
CN110457656A (en) A kind of document display method and apparatus
CN113158101B (en) Visual page rendering method, device, equipment and storage medium
US10318621B2 (en) Collating and intelligently sequencing installation documentation
CN111443909A (en) Method and device for generating page
JP2019091416A (en) Method and device for constructing artificial intelligence application
CN116954450A (en) Screenshot method and device for front-end webpage, storage medium and terminal
CN109753644B (en) Rich text editing method and device, mobile terminal and storage medium
CN110569488A (en) modular template WORD generation method based on XML (extensive markup language)
CN112632425B (en) Method, device, equipment and storage medium for generating offline resource file
CN114138372A (en) Front-end component loading method and device
CN111027333B (en) Chapter translation method and apparatus
CN112328257A (en) Code conversion method and device
CN113792531B (en) Text editing method and system based on markdown grammar expansion
US10409573B1 (en) Batch script decomposer
CN112765522B (en) Digital newspaper content generation method, system and computer readable storage medium
CN112395844B (en) Pinyin generation method and device and electronic equipment
CN114238831A (en) HTML code fragment processing method, system, electronic equipment and storage medium
CN111507079B (en) Multi-language document generation method, system and equipment
CN113110829A (en) Multi-UI component library data processing method and device
CN109857503B (en) Page interaction effect self-adaption method and device and electronic equipment
CN113377453A (en) Picture processing method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant