From d1fe35582d3f5ec8677808f980e104add6146b78 Mon Sep 17 00:00:00 2001 From: Harbs Date: Fri, 14 Jan 2022 12:05:02 +0200 Subject: [PATCH] small spelling and grammatical corrections --- docs/parser.md | 10 +++++----- docs/parsing_block.md | 10 +++++----- docs/parsing_core.md | 4 ++-- docs/parsing_inline.md | 10 +++++----- docs/plugins.md | 2 +- docs/renderer.md | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/docs/parser.md b/docs/parser.md index eea9e2c2..8b6a80f7 100644 --- a/docs/parser.md +++ b/docs/parser.md @@ -5,7 +5,7 @@ responsible for separating markdown syntax from plain text. The parsers scan the markdown content and use various rules to produce a list of tokens. Each token represents either a piece of markdown syntax (for example, the -begining of a fenced code block, a list item, etc.) or plain text that will be +beginning of a fenced code block, a list item, etc.) or plain text that will be included as-is (escaped) in the final HTML text. The tokens will be later be used by the [Renderer][renderer] to produce actual HTML. @@ -15,7 +15,7 @@ There are three kind of parsing rules in Remarkable: 2. [Block rules][block] 3. [Inline rules][inline] -Each uses different datastructures and signatures. Unless you wish to modify the +Each uses different data structures and signatures. Unless you wish to modify the internal workflow of Remarkable, you will most probably only deal with Block and Inline rules. @@ -41,13 +41,13 @@ Parsing rules will usually generates at least three tokens: 1. The start or open token marking the beginning of the markdown structure 2. The content token (usually with type `inline` for a block rule, or `text` for an inline rule) -3. The end or close token makring the end of the markdown structure +3. The end or close token marking the end of the markdown structure ### Tag token Tag tokens are used to represent markdown syntax. Each tag token represents a special markdown syntax in the original markdown source. They are usually used -for the open and close tokens. For example the "\`\`\`" at the begining of a +for the open and close tokens. For example the "\`\`\`" at the beginning of a fenced block code, the start of an item list or the end of a emphasized part of a line. @@ -68,7 +68,7 @@ A text token has a `content` property containing the text it represents. Inline tokens represent the content of a block structure. These tokens have two additional properties: -* `content`: The content of the block. This might include inline mardown syntax +* `content`: The content of the block. This might include inline markdown syntax which may need further processing by the inline rules. * `children`: This is initialized with an empty array (`[]`) and will be filled with the inline parser tokens as the inline parsing rules are applied. diff --git a/docs/parsing_block.md b/docs/parsing_block.md index 4e965e80..7697a867 100644 --- a/docs/parsing_block.md +++ b/docs/parsing_block.md @@ -5,16 +5,16 @@ or several full lines at once and emitting the [tokens][tokens] required to represent these markdown blocks. For example, block code, blockquotes, headers, hr, etc. -A block rule is a function expecting the following argumnents: +A block rule is a function expecting the following arguments: 1. `state`: an instance of `StateBlock` 2. `startLine`: the index of the current line 3. `endLine`: the index of the last available line 4. `checkMode`: a flag indicating whether we should simply check if the current - line marks the begining of the syntax we are trying to parse. + line marks the beginning of the syntax we are trying to parse. Both `startLine` and `endLine` refer to values used to index several -informations about lines within the `state`. +pieces of information about lines within the `state`. The `checkMode` is here for optimization, if it's set to `true`, we can return `true` as soon as we are sure the present line marks the beginning of a block we @@ -66,7 +66,7 @@ proceed with the complete parsing. NB: It is your responsibility to make sure you have reached the maximum nesting level allowed by comparing `state.level` and `state.options.maxNesting`. -NB: If for any reason, the block you are trying to parse is incorrectly formated +NB: If for any reason, the block you are trying to parse is incorrectly formatted and you are unable to parse it, you must abort and return `false` without modifying `state` in any way. @@ -74,7 +74,7 @@ To completely parse a block, you will need to emit additional [tokens][tokens] in `state.tokens`. Once you are sure the current line marks the beginning of one of "your" blocks, -you should push an [open tag token][tokens] corresponding to the begining of +you should push an [open tag token][tokens] corresponding to the beginning of your block. You will also need to find its end. Use the `state` methods to help you with this. diff --git a/docs/parsing_core.md b/docs/parsing_core.md index a7eb6cb7..7ed001f1 100644 --- a/docs/parsing_core.md +++ b/docs/parsing_core.md @@ -12,7 +12,7 @@ of: * `src`: the complete string the parser is currently working on * `tokens`: the tokens generated by the previous core rules, up to now * `env`: a namespaced data key-value store to allow core rules to exchange data -* `inlineMode`: a flag mentionning whether the parser is currently working as inline-mode only +* `inlineMode`: a flag mentioning whether the parser is currently working as inline-mode only or standard mode The rest are mostly components of the underlying remarkable instance. @@ -21,7 +21,7 @@ Some core rules process directly the `src` to produce a new set of tokens, others process the existing list of tokens in order to produce a new one. The most important predefined core rules are `block` and `inline` which are -reponsible for calling the subparsers for the [block][block] and +responsible for calling the subparsers for the [block][block] and [inline][inline] rules. To better understand how the core rules work, please read the code in diff --git a/docs/parsing_inline.md b/docs/parsing_inline.md index 0654855a..a9cc4654 100644 --- a/docs/parsing_inline.md +++ b/docs/parsing_inline.md @@ -5,11 +5,11 @@ only part of a line of text and emitting the [tokens][tokens] required to represent them. For example, a link, bold, emphasis, super/sub scripts, inline code, and so on. -An inline rule is a function expecting two argumnents: +An inline rule is a function expecting two arguments: 1. `state`: an instance of `StateInline` 4. `checkMode`: a flag indicating whether we should simply check if the current - position marks the begining of the syntax we are trying to parse. + position marks the beginning of the syntax we are trying to parse. The `checkMode` is here for optimization, if it's set to `true`, we can return `true` as soon as we are sure the present position marks the beginning of an @@ -42,14 +42,14 @@ The most important methods are: ## Rule parser behaviour If `checkMode` is set to true, simply return a boolean depending on whether the -current position should be considered has the begining of your +current position should be considered has the beginning of your syntax. Otherwise, proceed with the complete parsing. NB: It is your responsibility to make sure you have reached the maximum nesting level allowed by comparing `state.level` and `state.options.maxNesting`. NB: If for any reason, the syntax you are trying to parse is incorrectly -formated and you are unable to parse it, you must abort and return `false` +formatted and you are unable to parse it, you must abort and return `false` without modifying `state` in any way. To completely parse a block, you will need to push new [tokens][tokens] by @@ -57,7 +57,7 @@ calling `state.push(token)`. Once you are sure the current position marks the beginning of the syntax you are trying to parse, you should push an [open tag token][tokens] corresponding to -the begining of your inline section. You will also need to find its end. +the beginning of your inline section. You will also need to find its end. Your next decision should be whether you wish to allow other inline syntaxes to be nested in your content or not. If you do, you will need to invoke diff --git a/docs/plugins.md b/docs/plugins.md index fac8d6fc..5b26075f 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -22,7 +22,7 @@ Remarkable converts markdown to HTML in two steps: 1. Parsing markdown raw text to a list of tokens 2. Rendering the list of tokens to actual HTML code. -Parsing rules are divided into three differents kind of rules +Parsing rules are divided into three different kinds of rules ([core][core parsing], [block][block parsing] and [inline][inline parsing]). To add a parsing rule, you will need to get the relevant parser for your rule diff --git a/docs/renderer.md b/docs/renderer.md index 6e6f8fbc..efcc018d 100644 --- a/docs/renderer.md +++ b/docs/renderer.md @@ -1,6 +1,6 @@ # Renderer -Renderering is the second part of converting markdown to HTML. The renderer +Rendering is the second part of converting markdown to HTML. The renderer converts the list of [tokens][parser] produced by the [Parsers][parser] to produce actual HTML code.