Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ a streamlined variant of the [Keep a Changelog] spec. Notable changes are:
- `strip_markdown()` in ndg-commonmark now preserves inline code content. The
function previously silently dropped inline code like `` `grep` `` because
`NodeValue::Code` stores text in `.literal` rather than as child nodes.
- Fixed unsanitized `<code>` block in default values of the options HTML
generator

## [2.5.1]

Expand Down
15 changes: 10 additions & 5 deletions crates/ndg-html/src/template.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
use std::{collections::HashMap, fmt::Write, fs, path::Path, string::String};

use color_eyre::eyre::{Context, Result, bail};
use html_escape::encode_text;
use html_escape::{
encode_text,
encode_text_minimal_to_writer,
encode_text_to_writer,
};
use ndg_commonmark::Header;
use ndg_config::{Config, sidebar::SidebarOrdering};
use ndg_manpage::types::NixOption;
use ndg_utils::html::{calculate_root_relative_path, generate_asset_paths};
use serde::de::IntoDeserializer;
use serde_json::Value;
use tera::Tera;

Expand Down Expand Up @@ -1325,14 +1330,14 @@ fn add_default_value(html: &mut String, option: &NixOption) {
// Writing to String is infallible
let _ = writeln!(
html,
" <div class=\"option-default\">Default: \
<code>{clean_default}</code></div>"
" <div class=\"option-default\">Default: <code>{}</code></div>",
html_escape::encode_text(clean_default)
);
} else if let Some(default_val) = &option.default {
let _ = writeln!(
html,
" <div class=\"option-default\">Default: \
<code>{default_val}</code></div>"
" <div class=\"option-default\">Default: <code>{}</code></div>",
html_escape::encode_text(&default_val.to_string()),
);
}
}
Expand Down
Loading