fix: spaces in images
This commit is contained in:
parent
0c43a48349
commit
5d1a49ab06
3 changed files with 24 additions and 6 deletions
|
@ -5,7 +5,8 @@ pub fn render_markdown(input: &str) -> String {
|
|||
&parse_highlight(&parse_link(&parse_image(&parse_image_size(
|
||||
&parse_underline(&parse_comment(&input.replace("[/]", "<br />"))),
|
||||
)))),
|
||||
));
|
||||
))
|
||||
.replace("$per", "%");
|
||||
|
||||
let mut allowed_attributes = HashSet::new();
|
||||
allowed_attributes.insert("id");
|
||||
|
@ -475,7 +476,8 @@ fn parse_image_line(output: &mut String, buffer: &mut String, line: &str) {
|
|||
if in_image {
|
||||
// end
|
||||
output.push_str(&format!(
|
||||
"<img loading=\"lazy\" alt=\"{alt}\" src=\"{buffer}\" style=\"float: {}\" />",
|
||||
"<img loading=\"lazy\" alt=\"{alt}\" src=\"{}\" style=\"float: {}\" />",
|
||||
buffer.replace(" ", "$per20"),
|
||||
if buffer.ends_with("#left") {
|
||||
"left"
|
||||
} else if buffer.ends_with("#right") {
|
||||
|
@ -605,7 +607,7 @@ macro_rules! parser_ignores_pre {
|
|||
let mut buffer = String::new();
|
||||
|
||||
for line in $input.split("\n") {
|
||||
if line.starts_with("```") {
|
||||
if line.starts_with("```") | (line == "<style>") | (line == "</style>") {
|
||||
in_pre_block = !in_pre_block;
|
||||
output.push_str(&format!("{line}\n"));
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue