Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3370217
D5079.id16398.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D5079.id16398.diff
View Options
diff --git a/lib/shared/markdown.js b/lib/shared/markdown.js
--- a/lib/shared/markdown.js
+++ b/lib/shared/markdown.js
@@ -9,7 +9,6 @@
export type State = {
key?: string | number | void,
inline?: ?boolean,
- quotationsDepth?: number,
[string]: any,
};
@@ -88,7 +87,6 @@
const blockQuoteRegex: RegExp = /^( *>[^\n]+(?:\n[^\n]+)*)(?:\n|$)/;
const blockQuoteStripFollowingNewlineRegex: RegExp = /^( *>[^\n]+(?:\n[^\n]+)*)(?:\n|$){2}/;
-const maxNestedQuotations = 5;
const urlRegex: RegExp = /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/i;
@@ -233,7 +231,6 @@
codeBlockStripTrailingNewlineRegex,
fenceRegex,
fenceStripTrailingNewlineRegex,
- maxNestedQuotations,
jsonMatch,
jsonPrint,
matchList,
diff --git a/native/markdown/rules.react.js b/native/markdown/rules.react.js
--- a/native/markdown/rules.react.js
+++ b/native/markdown/rules.react.js
@@ -8,7 +8,6 @@
import { relativeMemberInfoSelectorForMembersOfThread } from 'lib/selectors/user-selectors';
import * as SharedMarkdown from 'lib/shared/markdown';
-import { maxNestedQuotations } from 'lib/shared/markdown';
import type { RelativeMemberInfo } from 'lib/types/thread-types';
import { useSelector } from '../redux/redux-utils';
@@ -216,27 +215,17 @@
blockQuote: {
...SimpleMarkdown.defaultRules.blockQuote,
// match end of blockQuote by either \n\n or end of string
- match: (source: string, state: SharedMarkdown.State) => {
- if (
- state.quotationsDepth &&
- state.quotationsDepth >= maxNestedQuotations
- ) {
- return null;
- }
- return SharedMarkdown.blockQuoteStripFollowingNewlineRegex.exec(source);
- },
+ match: SimpleMarkdown.blockRegex(
+ SharedMarkdown.blockQuoteStripFollowingNewlineRegex,
+ ),
parse(
capture: SharedMarkdown.Capture,
parse: SharedMarkdown.Parser,
state: SharedMarkdown.State,
) {
const content = capture[1].replace(/^ *> ?/gm, '');
- const currentQuotationsDepth = state.quotationsDepth ?? 0;
return {
- content: parse(content, {
- ...state,
- quotationsDepth: currentQuotationsDepth + 1,
- }),
+ content: parse(content, state),
};
},
// eslint-disable-next-line react/display-name
diff --git a/web/markdown/rules.react.js b/web/markdown/rules.react.js
--- a/web/markdown/rules.react.js
+++ b/web/markdown/rules.react.js
@@ -6,7 +6,6 @@
import { relativeMemberInfoSelectorForMembersOfThread } from 'lib/selectors/user-selectors';
import * as SharedMarkdown from 'lib/shared/markdown';
-import { maxNestedQuotations } from 'lib/shared/markdown';
import type { RelativeMemberInfo } from 'lib/types/thread-types';
import { useSelector } from '../redux/redux-utils';
@@ -79,27 +78,15 @@
blockQuote: {
...SimpleMarkdown.defaultRules.blockQuote,
// match end of blockQuote by either \n\n or end of string
- match: (source: string, state: SharedMarkdown.State) => {
- if (
- state.quotationsDepth &&
- state.quotationsDepth >= maxNestedQuotations
- ) {
- return null;
- }
- return SharedMarkdown.blockQuoteRegex.exec(source);
- },
+ match: SimpleMarkdown.blockRegex(SharedMarkdown.blockQuoteRegex),
parse(
capture: SharedMarkdown.Capture,
parse: SharedMarkdown.Parser,
state: SharedMarkdown.State,
) {
const content = capture[1].replace(/^ *> ?/gm, '');
- const currentQuotationsDepth = state.quotationsDepth ?? 0;
return {
- content: parse(content, {
- ...state,
- quotationsDepth: currentQuotationsDepth + 1,
- }),
+ content: parse(content, state),
};
},
},
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 1:27 AM (16 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2583387
Default Alt Text
D5079.id16398.diff (3 KB)
Attached To
Mode
D5079: Revert "[web/native] nested quotation display limit"
Attached
Detach File
Event Timeline
Log In to Comment