Closed pretzpockey closed 10 months ago
IIRC this is a concession from an old performance problem. It was either load the whole text and suffer poor performance in certain usage, or no performance problems but have this oddity with progressive loading of text.
IIRC this is a concession from an old performance problem. It was either load the whole text and suffer poor performance in certain usage, or no performance problems but have this oddity with progressive loading of text.
Thanks! Yes it looks like something progressive, perhaps it's the result of balancing.
And I tried to solve it by ensuring the layout for the whole character range, it works for me. However for the long text, it takes long time to be ready.
I can reproduce.
I can reproduce.
- Create a note with the text of Commonmark Spec
- open another note
- and then go back to the one created just now
- scroll down quickly to the bottom to reproduce this issue
Thanks @gingerbeardman I tried to disable allowsNonContiguousLayout from storyboard and the problem is gone. I think what you said at the beginning makes a lot of sense!
BTW do you know if there's any benefits from that option? Thanks again!
Basically, without it there are delays with certain edits.
Origin
Personally, allowsNonContiguousLayout never seemed like the right solution to the problem. It was the quickest and easiest with some known side-effects. Maybe it's time to look at it again?
Hi guys! At some point we need to migrate the core editor to textkit2. I hope someday.
Description
The editor view cannot load text fully at once, scroll to bottom quickly won't stop at the end of content, meanwhile the content seems to be appended more, and get another chance to scroll to the bottom.
https://github.com/glushchenko/fsnotes/assets/109065892/b26d3df8-673c-4efc-9810-4cbc0d700b41
To Reproduce
Create a note with the text below, open another note and then go back to the one created just now, scroll down quickly to the bottom to reproduce this issue.
TEXT BEGIN
List item one. + List item one continued with a second paragraph followed by an Indented block. + ................. $ ls .sh $ mv .sh ~/tmp ................. + List item continued with a third paragraph.
List item two continued with an open block. +
This paragraph is part of the preceding list item.
a. This list is nested and does not require explicit item continuation. + This paragraph is part of the preceding list item.
b. List item b.
This paragraph belongs to item two of the outer list.
List item one.
List item one continued with a second paragraph followed by an Indented block.
List item continued with a third paragraph.
List item two continued with an open block.
This paragraph is part of the preceding list item.
This list is nested and does not require explicit item continuation.
This paragraph is part of the preceding list item.
List item b.
This paragraph belongs to item two of the outer list.
The AsciiDoc version is, arguably, easier to write. You don't need to worry about indentation. But the Markdown version is much easier to read. The nesting of list items is apparent to the eye in the source, not just in the processed document.
Why is a spec needed?
John Gruber's canonical description of Markdown's syntax does not specify the syntax unambiguously. Here are some examples of questions it does not answer:
How much indentation is needed for a sublist? The spec says that continuation paragraphs need to be indented four spaces, but is not fully explicit about sublists. It is natural to think that they, too, must be indented four spaces, but
Markdown.pl
does not require that. This is hardly a "corner case," and divergences between implementations on this issue often lead to surprises for users in real documents. (See this comment by John Gruber.)Is a blank line needed before a block quote or heading? Most implementations do not require the blank line. However, this can lead to unexpected results in hard-wrapped text, and also to ambiguities in parsing (note that some implementations put the heading inside the blockquote, while others do not). (John Gruber has also spoken in favor of requiring the blank lines.)
Is a blank line needed before an indented code block? (
Markdown.pl
requires it, but this is not mentioned in the documentation, and some implementations do not require it.)What is the exact rule for determining when list items get wrapped in
<p>
tags? Can a list be partially "loose" and partially "tight"? What should we do with a list like this?Or this?
(There are some relevant comments by John Gruber here.)
Can list markers be indented? Can ordered list markers be right-aligned?
Is this one list with a thematic break in its second item, or two lists separated by a thematic break?
When list markers change from numbers to bullets, do we have two lists or one? (The Markdown syntax description suggests two, but the perl scripts and many other implementations produce one.)
What are the precedence rules for the markers of inline structure? For example, is the following a valid link, or does the code span take precedence ?
What are the precedence rules for markers of emphasis and strong emphasis? For example, how should the following be parsed?
What are the precedence rules between block-level and inline-level structure? For example, how should the following be parsed?
Can list items include section headings? (
Markdown.pl
does not allow this, but does allow blockquotes to include headings.)Can list items be empty?
Can link references be defined inside block quotes or list items?
If there are multiple definitions for the same reference, which takes precedence?
In the absence of a spec, early implementers consulted
Markdown.pl
to resolve these ambiguities. ButMarkdown.pl
was quite buggy, and gave manifestly bad results in many cases, so it was not a satisfactory replacement for a spec.Because there is no unambiguous spec, implementations have diverged considerably. As a result, users are often surprised to find that a document that renders one way on one system (say, a GitHub wiki) renders differently on another (say, converting to docbook using pandoc). To make matters worse, because nothing in Markdown counts as a "syntax error," the divergence often isn't discovered right away.
About this document
This document attempts to specify Markdown syntax unambiguously. It contains many examples with side-by-side Markdown and HTML. These are intended to double as conformance tests. An accompanying script
spec_tests.py
can be used to run the tests against any Markdown program:Since this document describes how Markdown is to be parsed into an abstract syntax tree, it would have made sense to use an abstract representation of the syntax tree instead of HTML. But HTML is capable of representing the structural distinctions we need to make, and the choice of HTML for the tests makes it possible to run the tests against an implementation without writing an abstract syntax tree renderer.
Note that not every feature of the HTML samples is mandated by the spec. For example, the spec says what counts as a link destination, but it doesn't mandate that non-ASCII characters in the URL be percent-encoded. To use the automatic tests, implementers will need to provide a renderer that conforms to the expectations of the spec examples (percent-encoding non-ASCII characters in URLs). But a conforming implementation can use a different renderer and may choose not to percent-encode non-ASCII characters in URLs.
This document is generated from a text file,
spec.txt
, written in Markdown with a small extension for the side-by-side tests. The scripttools/makespec.py
can be used to convertspec.txt
into HTML or CommonMark (which can then be converted into other formats).In the examples, the
→
character is used to represent tabs.Preliminaries
Characters and lines
Any sequence of [characters] is a valid CommonMark document.
A character is a Unicode code point. Although some code points (for example, combining accents) do not correspond to characters in an intuitive sense, all code points count as characters for purposes of this spec.
This spec does not specify an encoding; it thinks of lines as composed of [characters] rather than bytes. A conforming parser may be limited to a certain encoding.
A line is a sequence of zero or more [characters] other than line feed (
U+000A
) or carriage return (U+000D
), followed by a [line ending] or by the end of file.A line ending is a line feed (
U+000A
), a carriage return (U+000D
) not followed by a line feed, or a carriage return and a following line feed.A line containing no characters, or a line containing only spaces (
U+0020
) or tabs (U+0009
), is called a blank line.The following definitions of character classes will be used in this spec:
A Unicode whitespace character is any code point in the Unicode
Zs
general category, or a tab (U+0009
), line feed (U+000A
), form feed (U+000C
), or carriage return (U+000D
).Unicode whitespace is a sequence of one or more [Unicode whitespace characters].
Expected behavior
No response
FSNotes version
6.4.1
macOS/iOS version
13.6
Additional context
No response