1
0
Fork 0
mirror of https://github.com/Nutomic/ibis.git synced 2024-11-22 08:41:08 +00:00

Disable markdown plugins for url shortening and smartquotes (fixes #53)

This commit is contained in:
Felix Ableitner 2024-10-14 12:42:41 +02:00
parent 572a0cb51c
commit 3050617005
3 changed files with 38 additions and 29 deletions

View file

@ -99,7 +99,7 @@ fn create_cookie(jwt: String, data: &Data<IbisData>) -> Cookie<'static> {
// Must not set cookie domain on localhost
// https://stackoverflow.com/a/1188145
let domain = data.domain().to_string();
if domain.starts_with("localhost") || domain.starts_with("127.0.0.1") {
if !domain.starts_with("localhost") && !domain.starts_with("127.0.0.1") {
cookie = cookie.domain(domain);
}
cookie

View file

@ -9,7 +9,10 @@ use markdown_it::{
pub fn markdown_parser() -> MarkdownIt {
let mut parser = MarkdownIt::new();
markdown_it::plugins::cmark::add(&mut parser);
markdown_it::plugins::extra::add(&mut parser);
markdown_it::plugins::extra::linkify::add(&mut parser);
markdown_it::plugins::extra::strikethrough::add(&mut parser);
markdown_it::plugins::extra::tables::add(&mut parser);
markdown_it::plugins::extra::typographer::add(&mut parser);
parser.inline.add_rule::<ArticleLinkScanner>();
parser
}

View file

@ -131,10 +131,16 @@ pub fn EditArticle() -> impl IntoView {
})
}}
<textarea id="edit-article-textarea" rows=rows on:keyup=move |ev| {
let val = event_target_value(&ev);
set_text.update(|p| *p = val);
}>{article.article.text.clone()}</textarea>
<textarea
id="edit-article-textarea"
rows=rows
on:keyup=move |ev| {
let val = event_target_value(&ev);
set_text.update(|p| *p = val);
}
>
{article.article.text.clone()}
</textarea>
<div>
<a href="https://commonmark.org/help/" target="blank_">
Markdown
@ -142,31 +148,31 @@ pub fn EditArticle() -> impl IntoView {
" formatting is supported"
</div>
<div class="inputs">
<input
type="text"
placeholder="Edit summary"
value=summary.get_untracked()
on:keyup=move |ev| {
let val = event_target_value(&ev);
set_summary.update(|p| *p = val);
}
/>
<input
type="text"
placeholder="Edit summary"
value=summary.get_untracked()
on:keyup=move |ev| {
let val = event_target_value(&ev);
set_summary.update(|p| *p = val);
}
/>
<button
prop:disabled=move || button_is_disabled.get()
on:click=move |_| {
submit_action
.dispatch((
text.get(),
summary.get(),
article_.clone(),
edit_response.get(),
))
}
>
<button
prop:disabled=move || button_is_disabled.get()
on:click=move |_| {
submit_action
.dispatch((
text.get(),
summary.get(),
article_.clone(),
edit_response.get(),
))
}
>
Submit
</button>
Submit
</button>
</div>
</div>
}