Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Glasgow | 25-SDC-Nov | Nataliia Volkova | Sprint 1 | Bug Report: Fix hashtag link/hashtag links #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Nataliia74 wants to merge 2 commits into CodeYourFuture:main
base: main
Choose a base branch
Loading
from Nataliia74:fixHashtagLink/HashtagLinks
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions front-end/components/bloom.mjs
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const createBloom = (template, bloom) => {
bloomTimeLink.setAttribute("href", `/bloom/${bloom.id}`);
bloomContent.replaceChildren(
...bloomParser.parseFromString(_formatHashtags(bloom.content), "text/html")
.body.childNodes
.body.childNodes,
);

return bloomFrag;
Expand All @@ -37,8 +37,8 @@ const createBloom = (template, bloom) => {
function _formatHashtags(text) {
if (!text) return text;
return text.replace(
/\B#[^#]+/g,
(match) => `<a href="/hashtag/${match.slice(1)}">${match}</a>`
/\B#\w+/g,
(match) => `<a href="#/hashtag/${match.slice(1)}">${match}</a>`,
);
}

Expand Down Expand Up @@ -84,4 +84,4 @@ function _formatTimestamp(timestamp) {
}
}

export {createBloom};
export {createBloom};
20 changes: 8 additions & 12 deletions front-end/index.html
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Purple Forest</title>
<link href="/index.css" rel="stylesheet" />
<link href="./index.css" rel="stylesheet" />
</head>
<body id="app">
<header>
<a href="/"
><h1>
<img
src="/logo.svg"
alt="Purple Forest "
width="50"
height="60"
/>
<img src="./logo.svg" alt="Purple Forest " width="50" height="60" />
PurpleForest
</h1></a
>
Expand Down Expand Up @@ -189,8 +184,7 @@ <h1 id="signup-heading" class="signup__title">Create your account</h1>
</div>
<div class="profile__who-to-follow">
<h4>Who to follow</h4>
<ul data-who-to-follow>
</ul>
<ul data-who-to-follow></ul>
</div>
</section>
</template>
Expand Down Expand Up @@ -236,7 +230,9 @@ <h2 id="bloom-form-title" class="bloom-form__title">Share a Bloom</h2>
<article class="bloom box" data-bloom data-bloom-id="">
<div class="bloom__header flex">
<a href="#" class="bloom__username" data-username>Username</a>
<a href="#" class="bloom__time"><time class="bloom__time" data-time>2m</time></a>
<a href="#" class="bloom__time"
><time class="bloom__time" data-time>2m</time></a
>
</div>
<div class="bloom__content" data-content></div>
</article>
Expand All @@ -256,6 +252,6 @@ <h2 id="bloom-form-title" class="bloom-form__title">Share a Bloom</h2>
<p>Please enable JavaScript in your browser.</p>
</noscript>

<script type="module" src="/index.mjs"></script>
<script type="module" src="./index.mjs"></script>
</body>
</html>

AltStyle によって変換されたページ (->オリジナル) /