Skip to content

Commit

Permalink
Fix html tags in toc (#152)
Browse files Browse the repository at this point in the history
Changes made:
* fix: remove html tags when parsing the sections
  • Loading branch information
Builditluc authored Feb 15, 2023
2 parents 8aa164d + a222ab6 commit e0c19a7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/wiki/article.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use anyhow::{Context, Result};
use cursive::theme::Style;
use reqwest::blocking::{Client, Response};
use select::document::Document;
use serde::Deserialize;
use serde_repr::Deserialize_repr;
use std::{collections::HashMap, fmt::Display};
Expand Down Expand Up @@ -487,6 +488,11 @@ impl<I, P> ArticleBuilder<I, P> {
.filter_map(|(i, x)| {
serde_json::from_value(x).ok().map(|mut x: Section| {
x.index = i + 1;
let doc = Document::from(x.text());
// TODO: render html tags in the toc
if let Some(text) = doc.nth(0).map(|x| x.text()) {
x.text = text;
}
x
})
})
Expand Down

0 comments on commit e0c19a7

Please sign in to comment.