aboutsummaryrefslogtreecommitdiffstats
path: root/src/to_html.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-06 11:43:26 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-06 11:43:26 +0200
commitb75d7976cfe8db43783b930c1f4774f2ad4936f5 (patch)
treed8c38c5bc6d1427b408d0b6b53aeb33f39e8d704 /src/to_html.rs
parentc12c31e1b2d55fa407217c0e14c51c8693f919ae (diff)
downloadmarkdown-rs-b75d7976cfe8db43783b930c1f4774f2ad4936f5.tar.gz
markdown-rs-b75d7976cfe8db43783b930c1f4774f2ad4936f5.tar.bz2
markdown-rs-b75d7976cfe8db43783b930c1f4774f2ad4936f5.zip
Add support for HTML 4 character references in JSX attributes
Diffstat (limited to '')
-rw-r--r--src/to_html.rs12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/to_html.rs b/src/to_html.rs
index d7d054d..814f7cf 100644
--- a/src/to_html.rs
+++ b/src/to_html.rs
@@ -2,8 +2,8 @@
use crate::event::{Event, Kind, Name};
use crate::mdast::AlignKind;
use crate::util::{
+ character_reference::decode as decode_character_reference,
constant::{SAFE_PROTOCOL_HREF, SAFE_PROTOCOL_SRC},
- decode_character_reference::{decode_named, decode_numeric},
encode::encode,
gfm_tagfilter::gfm_tagfilter,
infer::{gfm_table_align, list_loose},
@@ -783,14 +783,8 @@ fn on_exit_character_reference_value(context: &mut CompileContext) {
context.bytes,
&Position::from_exit_event(context.events, context.index),
);
- let value = slice.as_str();
-
- let value = match marker {
- b'#' => decode_numeric(value, 10),
- b'x' => decode_numeric(value, 16),
- b'&' => decode_named(value),
- _ => panic!("impossible"),
- };
+ let value = decode_character_reference(slice.as_str(), marker, true)
+ .expect("expected to parse only valid named references");
context.push(&encode(&value, context.encode_html));
}