Skip to content
Snippets Groups Projects
Commit 562eaa1d authored by tezlm's avatar tezlm Committed by 🥺
Browse files

Allow using languages in code blocks.

```yaml
This works now
```
parent 3e9c5642
No related branches found
No related tags found
No related merge requests found
...@@ -398,7 +398,7 @@ async fn process_admin_command( ...@@ -398,7 +398,7 @@ async fn process_admin_command(
AdminCommand::Appservice(command) => match command { AdminCommand::Appservice(command) => match command {
AppserviceCommand::Register => { AppserviceCommand::Register => {
if body.len() > 2 if body.len() > 2
&& body[0].trim() == "```" && body[0].trim().starts_with("```")
&& body.last().unwrap().trim() == "```" && body.last().unwrap().trim() == "```"
{ {
let appservice_config = body[1..body.len() - 1].join("\n"); let appservice_config = body[1..body.len() - 1].join("\n");
...@@ -596,7 +596,7 @@ async fn process_admin_command( ...@@ -596,7 +596,7 @@ async fn process_admin_command(
} }
UserCommand::DeactivateAll { leave_rooms, force } => { UserCommand::DeactivateAll { leave_rooms, force } => {
if body.len() > 2 if body.len() > 2
&& body[0].trim() == "```" && body[0].trim().starts_with("```")
&& body.last().unwrap().trim() == "```" && body.last().unwrap().trim() == "```"
{ {
let usernames = body.clone().drain(1..body.len() - 1).collect::<Vec<_>>(); let usernames = body.clone().drain(1..body.len() - 1).collect::<Vec<_>>();
...@@ -710,7 +710,7 @@ async fn process_admin_command( ...@@ -710,7 +710,7 @@ async fn process_admin_command(
} }
FederationCommand::SignJson => { FederationCommand::SignJson => {
if body.len() > 2 if body.len() > 2
&& body[0].trim() == "```" && body[0].trim().starts_with("```")
&& body.last().unwrap().trim() == "```" && body.last().unwrap().trim() == "```"
{ {
let string = body[1..body.len() - 1].join("\n"); let string = body[1..body.len() - 1].join("\n");
...@@ -738,7 +738,7 @@ async fn process_admin_command( ...@@ -738,7 +738,7 @@ async fn process_admin_command(
} }
FederationCommand::VerifyJson => { FederationCommand::VerifyJson => {
if body.len() > 2 if body.len() > 2
&& body[0].trim() == "```" && body[0].trim().starts_with("```")
&& body.last().unwrap().trim() == "```" && body.last().unwrap().trim() == "```"
{ {
let string = body[1..body.len() - 1].join("\n"); let string = body[1..body.len() - 1].join("\n");
...@@ -826,7 +826,7 @@ async fn process_admin_command( ...@@ -826,7 +826,7 @@ async fn process_admin_command(
} }
DebugCommand::ParsePdu => { DebugCommand::ParsePdu => {
if body.len() > 2 if body.len() > 2
&& body[0].trim() == "```" && body[0].trim().starts_with("```")
&& body.last().unwrap().trim() == "```" && body.last().unwrap().trim() == "```"
{ {
let string = body[1..body.len() - 1].join("\n"); let string = body[1..body.len() - 1].join("\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment