Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
6cff7972
Unverified
Commit
6cff7972
authored
Nov 06, 2025
by
boojack
Committed by
GitHub
Nov 06, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(web): fix tag syntax rendering on first line (#5226)
Co-authored-by:
Claude
<
noreply@anthropic.com
>
parent
8f0658e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
remark-tag.ts
web/src/utils/remark-plugins/remark-tag.ts
+6
-4
No files found.
web/src/utils/remark-plugins/remark-tag.ts
View file @
6cff7972
...
@@ -80,10 +80,13 @@ function parseTagsFromText(text: string): Array<{ type: "text" | "tag"; value: s
...
@@ -80,10 +80,13 @@ function parseTagsFromText(text: string): Array<{ type: "text" | "tag"; value: s
*/
*/
export
const
remarkTag
=
()
=>
{
export
const
remarkTag
=
()
=>
{
return
(
tree
:
Root
)
=>
{
return
(
tree
:
Root
)
=>
{
visit
(
tree
,
"text"
,
(
node
:
Text
,
index
,
parent
)
=>
{
// Process text nodes in all node types (paragraphs, headings, etc.)
if
(
!
parent
||
index
===
null
)
return
;
visit
(
tree
,
(
node
:
any
,
index
,
parent
)
=>
{
// Only process text nodes that have a parent and index
if
(
node
.
type
!==
"text"
||
!
parent
||
index
===
null
)
return
;
const
text
=
node
.
value
;
const
textNode
=
node
as
Text
;
const
text
=
textNode
.
value
;
const
segments
=
parseTagsFromText
(
text
);
const
segments
=
parseTagsFromText
(
text
);
// If no tags found, leave node as-is
// If no tags found, leave node as-is
...
@@ -118,7 +121,6 @@ export const remarkTag = () => {
...
@@ -118,7 +121,6 @@ export const remarkTag = () => {
});
});
// Replace the current node with the new nodes
// Replace the current node with the new nodes
// @ts-expect-error - mdast types are complex, this is safe
parent
.
children
.
splice
(
index
,
1
,
...
newNodes
);
parent
.
children
.
splice
(
index
,
1
,
...
newNodes
);
});
});
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment