From 97a3f7742a0d5e7f057a86db93a4f9e3847fe500 Mon Sep 17 00:00:00 2001 From: lifegpc Date: Sun, 29 Oct 2023 13:18:41 +0000 Subject: [PATCH] add markdown_description to json data file --- src/data/json.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/data/json.rs b/src/data/json.rs index fe350de5..93e2899b 100644 --- a/src/data/json.rs +++ b/src/data/json.rs @@ -2,7 +2,7 @@ use super::fanbox::FanboxData; use crate::data::data::PixivData; use crate::ext::json::{ToJson, ToJson2}; use crate::gettext; -use crate::parser::description::parse_description; +use crate::parser::description::{convert_description_to_md, parse_description}; use crate::pixiv_link::PixivID; use crate::pixiv_link::ToPixivID; use int_enum::IntEnum; @@ -94,11 +94,16 @@ impl From<&PixivData> for JSONDataFile { f.add("author", p.author.as_ref().unwrap()); } if p.description.is_some() { - f.add("description", p.description.as_ref().unwrap()); - let pd = parse_description(p.description.as_ref().unwrap()); + let desc = p.description.as_ref().unwrap(); + f.add("description", desc); + let pd = parse_description(desc); if pd.is_some() { f.add("parsed_description", pd.unwrap()); } + let md = convert_description_to_md(desc); + if md.is_ok() { + f.add("markdown_description", md.unwrap()); + } } match p.tags.as_ref() { Some(tags) => {