fix: count style element as in pre
This commit is contained in:
parent
6451f929b4
commit
105d01b45d
1 changed files with 4 additions and 4 deletions
|
@ -741,7 +741,7 @@ pub fn parse_page(input: &str) -> String {
|
||||||
let mut in_pre = false;
|
let mut in_pre = false;
|
||||||
|
|
||||||
for line in input.split("\n") {
|
for line in input.split("\n") {
|
||||||
if line.starts_with("```") {
|
if line.starts_with("```") || line.starts_with("<style>") || line.starts_with("</style>") {
|
||||||
in_pre = !in_pre;
|
in_pre = !in_pre;
|
||||||
|
|
||||||
if in_page {
|
if in_page {
|
||||||
|
@ -830,7 +830,7 @@ pub fn parse_details(input: &str) -> String {
|
||||||
let mut in_pre = false;
|
let mut in_pre = false;
|
||||||
|
|
||||||
for line in input.split("\n") {
|
for line in input.split("\n") {
|
||||||
if line.starts_with("```") {
|
if line.starts_with("```") || line.starts_with("<style>") || line.starts_with("</style>") {
|
||||||
in_pre = !in_pre;
|
in_pre = !in_pre;
|
||||||
|
|
||||||
if in_details {
|
if in_details {
|
||||||
|
@ -899,7 +899,7 @@ pub fn get_toc_list(input: &str) -> (String, String) {
|
||||||
let mut in_pre = false;
|
let mut in_pre = false;
|
||||||
|
|
||||||
for line in input.split("\n") {
|
for line in input.split("\n") {
|
||||||
if line.starts_with("```") {
|
if line.starts_with("```") || line.starts_with("<style>") || line.starts_with("</style>") {
|
||||||
in_pre = !in_pre;
|
in_pre = !in_pre;
|
||||||
output.push_str(&format!("{line}\n"));
|
output.push_str(&format!("{line}\n"));
|
||||||
continue;
|
continue;
|
||||||
|
@ -959,7 +959,7 @@ pub fn parse_toc(input: &str) -> String {
|
||||||
let mut in_pre = false;
|
let mut in_pre = false;
|
||||||
|
|
||||||
for line in new_input.split("\n") {
|
for line in new_input.split("\n") {
|
||||||
if line.starts_with("```") {
|
if line.starts_with("```") || line.starts_with("<style>") || line.starts_with("</style>") {
|
||||||
in_pre = !in_pre;
|
in_pre = !in_pre;
|
||||||
output.push_str(&format!("{line}\n"));
|
output.push_str(&format!("{line}\n"));
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue