File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -319,7 +319,7 @@ fn write_post(
319319 file. write_all ( meta. render ( ) ?. as_bytes ( ) ) ?;
320320 file. write_all ( b"\n \n " ) ?;
321321 let basename = path. basename ( ) . ok_or_eyre ( "path has no basename" ) ?;
322- let unsafe_html = process_content ( & e_content, basename, & base_href, & RealAttachmentsContext ) ?;
322+ let unsafe_html = process_content ( e_content, basename, base_href, & RealAttachmentsContext ) ?;
323323 let post = TemplatedPost :: filter ( & unsafe_html, Some ( path. clone ( ) ) ) ?;
324324 file. write_all ( post. safe_html . as_bytes ( ) ) ?;
325325 info ! ( "click here to reply: {}" , path. compose_reply_url( ) ) ;
@@ -378,8 +378,8 @@ fn process_content(
378378 if attr_names. contains ( & attr. name ) {
379379 // rewrite urls in links to bake in the `base_href`.
380380 let old_url = attr. value . to_str ( ) . to_owned ( ) ;
381- let new_url = if old_url. starts_with ( '#' ) {
382- format ! ( "#user-content-{}" , & old_url [ 1 .. ] )
381+ let new_url = if let Some ( end ) = old_url. strip_prefix ( '#' ) {
382+ format ! ( "#user-content-{end}" )
383383 } else {
384384 base_href. join ( & old_url) ?. to_string ( )
385385 } ;
You can’t perform that action at this time.
0 commit comments