fix(anatomy): R5.4 guard covers links, autolinks, references, CJK underscores; ids validated at the op; prescan before the drawing comparison

This commit is contained in:
bchanot committed 2026-10-23 12:10:35 +02:00
1 parent 68dec25e5e
commit df82424107
9 files changed
+195 -12

No files matched your search

+9
View File
@@ -98,6 +98,15 @@ pub fn split_field(field: &str) -> Result<Vec<&str>, PipelineError> {
"field \"{field}\" has more than {MAX_FIELD_SEGMENTS} segments"
)));
}
// A control character or a backtick would reach the reports' code spans through the record.
if path
.iter()
.any(|key| key.chars().any(|c| c.is_control() && c != '\0') || key.contains('`'))
{
return Err(fail(format!(
"field {field:?} holds a control character or a backtick"
)));
}
if let Some(key) = path.iter().find(|key| key.starts_with('\0')) {
return Err(fail(format!("reserved key {key:?} in field \"{field}\"")));
}
+35
View File
@@ -17,6 +17,7 @@ use super::targets::{
id_text, item_at_mut, list_at, list_at_mut, locate, top_collection_path,
};
use crate::curation::PipelineError;
use crate::domain::js;
fn collection_kind(field: DocumentCollection) -> TargetKind {
match field {
@@ -190,6 +191,7 @@ fn apply_rename(
return Err(fail("the document has no id to rename"));
};
let key = located.target.kind.key_field();
assert_stable_id(Some(&Value::from(op.id.as_str())), key)?;
assert_free(list_at(doc, list)?, key, &op.id, Some(located.index))?;
let item = item_at_mut(doc, &located.item_path())?;
let before = Value::Object(item.clone());
@@ -246,6 +248,35 @@ fn add_destination(doc: &mut Value, op: &AddOp) -> Result<Destination, PipelineE
/// TypeScript met a null or a primitive there inconsistently (a TypeError when it walked it,
/// silently skipped when a rename walked past it, refused by the gate when it stayed); the
/// port refuses it at the add (RUST.md §11.12). Walked with an explicit stack.
/// An id an op writes must already be what the final document requires (a stable id; a region
/// code for a region): an id that passed only because a later op removed or renamed its item
/// would still reach the records, and from them the reports' code spans (a line break there
/// forged sections). Refused at the op (RUST.md §11.14).
fn assert_stable_id(value: Option<&Value>, key: &str) -> Result<(), PipelineError> {
let valid = match value.and_then(Value::as_str) {
Some(id) if key == "code" => js::is_region_code(id),
Some(id) => js::is_stable_id(id),
None => false,
};
if !valid {
return Err(fail(format!(
"the {} {:?} is not a valid {}",
key,
value.map(js_string_value).unwrap_or_default(),
if key == "code" {
"region code"
} else {
"stable id"
}
)));
}
Ok(())
}
fn js_string_value(value: &Value) -> String {
super::records::js_string(Some(value))
}
fn assert_object_children(value: &Value) -> Result<(), PipelineError> {
let mut pending = vec![value];
while let Some(item) = pending.pop() {
@@ -267,6 +298,9 @@ fn assert_object_children(value: &Value) -> Result<(), PipelineError> {
"the added item holds a \"{key}\" entry that is not an object"
)));
}
for entry in list {
assert_stable_id(entry.get("id"), "id")?;
}
pending.extend(list);
}
}
@@ -289,6 +323,7 @@ fn apply_add(
dest.key
)));
};
assert_stable_id(value.get(dest.key), dest.key)?;
let list = list_at(doc, &dest.list)?;
assert_free(list, dest.key, id, None)?;
let index = insertion_index(list, dest.key, op.position.as_ref())?;
+6 -5
View File
@@ -159,12 +159,13 @@ fn number(geometry: &Value, key: &str) -> f64 {
.unwrap_or(f64::NAN)
}
/// `String(number)`, NaN included.
/// `String(number)`, NaN and the infinities included.
fn text_of(value: f64) -> String {
if value.is_nan() {
"NaN".to_owned()
} else {
js_number(value)
match value {
v if v.is_nan() => "NaN".to_owned(),
f64::INFINITY => "Infinity".to_owned(),
f64::NEG_INFINITY => "-Infinity".to_owned(),
v => js_number(v),
}
}
@@ -126,8 +126,9 @@ pub fn compare_drawing(
let Some(rule) = rule else {
return Err("bytes differ and no tree rule is declared".to_owned());
};
let (prolog, epilog) = outside_root(committed).map_err(|e| format!("committed: {e}"))?;
// The core reader first: its prescan bounds the depth before any recursive parse.
let tree = parse_svg(committed).map_err(|e| format!("committed: {}", e.reason()))?;
let (prolog, epilog) = outside_root(committed).map_err(|e| format!("committed: {e}"))?;
if format!("{prolog}{}{epilog}", serialize(&tree)) != committed {
return Err("the committed file holds what its tree does not carry".to_owned());
}
+55 -2
View File
@@ -70,7 +70,8 @@ pub fn code(value: Option<&str>) -> String {
/// The plain text of a raw line Prettier would rewrite, found in its parts outside code spans
/// (`oracles/r5/markdown-sweep.json`): `*` outside a `**strong**` span; an underscore not between two letters or digits; a
/// backslash before a space or at the end, or an authored one before the cell escape `\|`
/// (`\"` in a JSON value is kept as written); two spaces in a row, a tab, a carriage return.
/// (`\"` in a JSON value is kept as written); two spaces in a row, a tab, a carriage return;
/// the inline constructs of `rewritten_construct`.
/// The parts of plain text outside the `**strong**` spans Prettier keeps as written (the
/// opening and closing pairs bounded by a non-word character or the line's edge, the inside
/// non-empty, without `*` and without an outer space). `None` when a `*` is left outside
@@ -101,14 +102,61 @@ fn outside_strong(plain: &str) -> Option<String> {
(!out.contains('*')).then_some(out)
}
/// Inline constructs Prettier re-prints (the sweep's link, wiki-link, autolink and reference
/// probes): a link, image or reference (`](`, `][`), a wiki link with inner spaces, an autolink
/// (`<scheme:…>`, `<…@…>`), a character reference (`&name;`, `&#n;`). The last three are refused
/// whole although Prettier keeps some of them: a loud refusal, never met by the equine data.
fn rewritten_construct(plain: &str) -> bool {
// `[[ a ]]` loses its inner spaces; `[[a]]` and a polygon's `[[10,10],…]` stay as written.
let padded_wiki = plain.split("[[").skip(1).any(|after| {
let inside = after.split("]]").next().unwrap_or_default();
after.contains("]]")
&& (inside.starts_with(char::is_whitespace) || inside.ends_with(char::is_whitespace))
});
if plain.contains("](") || plain.contains("][") || padded_wiki {
return true;
}
let autolink = plain.split('<').skip(1).any(|after| {
let inside = after.split('>').next().unwrap_or_default();
let closed = after.contains('>');
let scheme = inside.split(':').next().unwrap_or_default();
let is_scheme = inside.contains(':')
&& (2..=32).contains(&scheme.len())
&& scheme
.chars()
.next()
.is_some_and(|c| c.is_ascii_alphabetic())
&& scheme
.chars()
.all(|c| c.is_ascii_alphanumeric() || "+.-".contains(c));
closed && !inside.contains(' ') && (is_scheme || inside.contains('@'))
});
let reference = plain.split('&').skip(1).any(|after| {
let name = after.split(';').next().unwrap_or_default();
after.contains(';')
&& !name.is_empty()
&& name.len() <= 32
&& name
.trim_start_matches('#')
.chars()
.all(|c| c.is_ascii_alphanumeric())
});
autolink || reference
}
fn plain_rewrite(plain: &str) -> bool {
if rewritten_construct(plain) {
return true;
}
let Some(plain) = outside_strong(plain) else {
return true;
};
let chars: Vec<char> = plain.chars().collect();
// An underscore Prettier keeps sits between two ASCII letters or digits: the sweep shows it
// escapes one next to an accented letter, a CJK, kana or Hangul character.
let word = |i: Option<usize>| {
i.and_then(|i| chars.get(i))
.is_some_and(|c| c.is_alphanumeric())
.is_some_and(char::is_ascii_alphanumeric)
};
chars.iter().enumerate().any(|(i, &c)| match c {
'*' | '\t' | '\r' => true,
@@ -140,6 +188,11 @@ fn guard_line(line: &str) -> Result<(), PipelineError> {
fn guard_text(line: &str) -> Result<(), PipelineError> {
let parts: Vec<&str> = line.split('`').collect();
let refuse = || Err(PipelineError::UnsupportedMarkdown(line.to_owned()));
// No carriage return or tab anywhere, code spans included (a CR there broke a table row;
// the other control characters align as Prettier aligns them, `oracles/r5/markdown-tables.json`).
if line.contains(['\r', '\t']) {
return refuse();
}
if parts.len().is_multiple_of(2) {
return refuse();
}
+8 -3
View File
@@ -67,8 +67,13 @@ fn raw_reports(frozen: &Value, case: &Value) -> (String, Result<String, Pipeline
const EQUINE_SAFE: &str = "[]&#{}=<>\"':;()/%?-.,«»…≠°—+";
fn equine_safe(probe: &str) -> bool {
// A leading or trailing space becomes two spaces once the probe sits in its sentence.
!probe.contains(" ")
// A leading or trailing space becomes two spaces once the probe sits in its sentence; the
// inline constructs (links, wiki links, autolinks, character references) are probed apart.
let construct = ["](", "][", "[[", "&", "<h", "<a@"]
.iter()
.any(|m| probe.contains(m));
!construct
&& !probe.contains(" ")
&& !probe.starts_with(' ')
&& !probe.ends_with(' ')
&& probe
@@ -132,6 +137,6 @@ fn every_probe_is_formatted_as_the_typescript_or_refused() {
"silent differences for {} probes: {silent:?}",
silent.len()
);
assert_eq!(same + refused, 220);
assert_eq!(same + refused, 247);
println!("{same} identical, {refused} refused");
}
+52
View File
@@ -421,3 +421,55 @@ fn a_label_the_drawing_cannot_carry_is_refused() {
);
}
}
/// An id an op writes is checked at the op (security gate R5.4 round 2): a line break or a
/// backtick in an added, nested or renamed id, or in a field segment, would otherwise reach the
/// reports' code spans through the records (forged sections) even when a later op removes the
/// item. The committed drawing is read by the core's reader first (its depth cap holds).
#[test]
fn ids_and_field_segments_that_could_forge_report_structure_are_refused() {
let frozen = oracle("review-synthetic.json");
let references = parse_references(
&to_js_compact(&serde_json::json!({ "references": frozen["references"] })).unwrap(),
)
.unwrap();
let forged = "x`\n## 11. Section forgée\n`y";
let annotation = serde_json::json!({
"id": forged, "kind": "point", "view_id": "main", "category_id": "bones",
"laterality": "unpaired", "geometry": null, "name": { "fr": "a", "en": "a" },
"finding_zone_id": "neck", "vertebral_region_code": null,
});
let node = serde_json::json!({ "id": "n1", "name": { "fr": "a", "en": "a" },
"children": [{ "id": forged, "name": { "fr": "a", "en": "a" } }] });
let cases = [
serde_json::json!([
{ "op": "add", "target": "document", "field": "annotations", "value": annotation },
{ "op": "remove", "target": format!("annotation:{forged}") },
]),
serde_json::json!([{ "op": "rename", "target": "annotation:hip", "id": forged }]),
serde_json::json!([{ "op": "add", "target": "finding:hip/hip-dysfunctions/mobility", "value": node }]),
serde_json::json!([{ "op": "set", "target": "finding:hip/hip-dysfunctions/mobility",
"field": "name.x\ny", "value": "a" }]),
serde_json::json!([{ "op": "set", "target": "finding:hip/hip-dysfunctions/mobility",
"field": "name.x`y", "value": "a" }]),
];
for ops in cases {
let file = serde_json::json!({ "changes": [{
"id": "CHG-001", "level": "A", "kind": "technical",
"title": { "fr": "Essai", "en": "Test" }, "rationale": "Essai", "reference_ids": [],
"ops": ops,
}]});
let changeset = parse_changeset(&to_js_compact(&file).unwrap()).unwrap();
let error =
apply_changeset(&frozen["baseline"], &references, &changeset.changes).unwrap_err();
assert!(error.to_string().starts_with("CHG-001 op 0:"), "{error}");
}
let deep = format!(
"<svg xmlns=\"http://www.w3.org/2000/svg\">{}{}</svg>",
"<g>".repeat(100_000),
"</g>".repeat(100_000)
);
let (_, draft) = equine();
let rule = TriggerNames::of(&typed(&draft.document));
assert!(compare_drawing("<svg/>", &deep, Some(&rule)).is_err());
}
@@ -1 +1 @@
{"baseline":{"schema_version":2,"species_id":"equine","name":{"fr":"Mini","en":"Mini"},"description":{},"scope_disclaimer":{},"attribution":{"authors":[],"license":null,"notes":null},"vertebral_config":{"regions":[{"code":"C","name":{"fr":"Cervicales","en":"Cervical"},"count":7},{"code":"T","name":{"fr":"Thoraciques","en":"Thoracic"},"count":18}]},"references":[],"categories":[{"id":"joints","name":{"fr":"Articulations","en":"Joints"},"color":null},{"id":"bones","name":{"fr":"Os","en":"Bones"},"color":null}],"views":[{"id":"main","kind":"main","name":{"fr":"Vue","en":"View"},"svg_asset_id":"3f6c1b52-8a4e-4d17-9b0c-5e2a7d91c4f8","view_box":null},{"id":"head","kind":"detail","parent_view_id":"main","name":{"fr":"Tête","en":"Head"},"svg_asset_id":null,"view_box":{"min_x":0,"min_y":0,"width":10,"height":10}}],"annotations":[{"id":"hip","kind":"point","view_id":"main","category_id":"joints","laterality":"bilateral","geometry":{"type":"circle","cx":1,"cy":2,"r":3},"name":{"fr":"Hanche","en":"Hip"},"finding_zone_id":"hip","vertebral_region_code":null},{"id":"neck","kind":"zone","view_id":"main","category_id":"bones","laterality":"unpaired","geometry":null,"name":{"fr":"Cou","en":"Neck"},"finding_zone_id":"neck","vertebral_region_code":"C"},{"id":"head-trigger","kind":"detail_trigger","view_id":"main","category_id":"bones","laterality":"unpaired","geometry":null,"name":null,"opens_view_id":"head"}],"finding_zones":[{"id":"hip","name":{"fr":"Hanche","en":"Hip"},"categories":[{"id":"hip-dysfunctions","kind":"dysfunction","name":{"fr":"Dysfonctions","en":"Dysfunctions"},"children":[{"id":"mobility","name":{"fr":"mobility fr","en":"mobility en"},"children":[{"id":"flexion","name":{"fr":"flexion fr","en":"flexion en"}},{"id":"extension","name":{"fr":"extension fr","en":"extension en"}}]},{"id":"pain","name":{"fr":"pain fr","en":"pain en"}}]},{"id":"anamnesis","kind":"anamnesis","name":{"fr":"Anamnèse","en":"Anamnesis"},"children":[{"id":"trauma","name":{"fr":"trauma fr","en":"trauma en"}}]}]},{"id":"neck","name":{"fr":"Cou","en":"Neck"},"categories":[{"id":"neck-dysfunctions","kind":"dysfunction","name":{"fr":"Dysfonctions","en":"Dysfunctions"},"children":[{"id":"stiffness","name":{"fr":"stiffness fr","en":"stiffness en"}},{"id":"vet","name":{"fr":"vet fr","en":"vet en"},"requires_vet_referral":true}]}]}]},"references":[{"id":"atlas","type":"book","citation":"Atlas of anatomy","url":null,"doi":null},{"id":"paper","type":"journal","citation":"A paper","url":null,"doi":"10.1/x"}],"legacy_id_map":{"views":{"head":"head"},"annotations":{"legacy-hip":"hip","legacy-neck":"neck"},"categories":{},"finding_nodes":{},"assets":{}},"cases":[{"probe":"*","changes_file":{"changes":[{"id":"CHG-001","level":"C","kind":"correction","title":{"fr":"Titre *","en":"Title"},"rationale":"Raison * fin.","reference_ids":[],"question":"Question * ?","ops":[{"op":"add","target":"document","field":"references","value":{"id":"probe-ref","type":"web","citation":"Citation *","url":null,"doi":null}},{"op":"cite","target":"finding:hip/hip-dysfunctions/mobility","reference_ids":["probe-ref"]},{"op":"set","target":"finding:hip/hip-dysfunctions/mobility","field":"name.en","value":"Label *"}]}]},"changelog_raw":"# Journal des changements : révision de travail\n\nGénéré par `pnpm import:equine` : import historique (`legacy-import/`) puis changements rédigés (`curation/changes.json`). Ne pas modifier à la main : relancer la commande.\n\nNiveaux : A = erreur démontrée, B = amélioration étayée, C = point incertain. Les niveaux B et C demandent une confirmation professionnelle.\n\n## Comparaison quantitative\n\n| Indicateur | Avant | Après |\n| --- | --- | --- |\n| Vues | 2 | 2 |\n| Dessins SVG distincts | 1 | 1 |\n| Annotations | 3 | 3 |\n| Annotations (point) | 1 | 1 |\n| Annotations (zone) | 1 | 1 |\n| Annotations (detail_trigger) | 1 | 1 |\n| Annotations, revue (inherited) | 3 | 3 |\n| Annotations, revue (reviewed) | 0 | 0 |\n| Annotations, revue (to_confirm) | 0 | 0 |\n| Catégories d'annotation | 2 | 2 |\n| Zones de constats | 2 | 2 |\n| Catégories de constats | 3 | 3 |\n| Nœuds (catégories incluses) | 10 | 10 |\n| Feuilles | 6 | 6 |\n| Renvois vétérinaires | 1 | 1 |\n| Nœuds, revue (inherited) | 10 | 9 |\n| Nœuds, revue (reviewed) | 0 | 0 |\n| Nœuds, revue (to_confirm) | 0 | 1 |\n| Descriptions | 0 | 0 |\n| Descriptions en français seulement | 0 | 0 |\n| Références bibliographiques | 0 | 3 |\n| Nœuds cités | 0 | 1 |\n| Régions vertébrales avec plage documentée | 0 | 0 |\n\n## Migration des bilans v2\n\n| Nœuds | Nombre |\n| --- | --- |\n| Nœuds du catalogue historique | 10 |\n| Chemin identique | 10 |\n| Chemin renommé ou déplacé (suivi des renommages) | 0 |\n| Relogé sous une autre catégorie (correspondance unique) | 0 |\n| Retiré : le bilan garde le constat avec ses libellés figés | 0 |\n\n## Niveau A : erreurs démontrées\n\nAucun changement de ce niveau.\n\n## Niveau B : améliorations étayées (confirmatioLine truncated
{"baseline":{"schema_version":2,"species_id":"equine","name":{"fr":"Mini","en":"Mini"},"description":{},"scope_disclaimer":{},"attribution":{"authors":[],"license":null,"notes":null},"vertebral_config":{"regions":[{"code":"C","name":{"fr":"Cervicales","en":"Cervical"},"count":7},{"code":"T","name":{"fr":"Thoraciques","en":"Thoracic"},"count":18}]},"references":[],"categories":[{"id":"joints","name":{"fr":"Articulations","en":"Joints"},"color":null},{"id":"bones","name":{"fr":"Os","en":"Bones"},"color":null}],"views":[{"id":"main","kind":"main","name":{"fr":"Vue","en":"View"},"svg_asset_id":"3f6c1b52-8a4e-4d17-9b0c-5e2a7d91c4f8","view_box":null},{"id":"head","kind":"detail","parent_view_id":"main","name":{"fr":"Tête","en":"Head"},"svg_asset_id":null,"view_box":{"min_x":0,"min_y":0,"width":10,"height":10}}],"annotations":[{"id":"hip","kind":"point","view_id":"main","category_id":"joints","laterality":"bilateral","geometry":{"type":"circle","cx":1,"cy":2,"r":3},"name":{"fr":"Hanche","en":"Hip"},"finding_zone_id":"hip","vertebral_region_code":null},{"id":"neck","kind":"zone","view_id":"main","category_id":"bones","laterality":"unpaired","geometry":null,"name":{"fr":"Cou","en":"Neck"},"finding_zone_id":"neck","vertebral_region_code":"C"},{"id":"head-trigger","kind":"detail_trigger","view_id":"main","category_id":"bones","laterality":"unpaired","geometry":null,"name":null,"opens_view_id":"head"}],"finding_zones":[{"id":"hip","name":{"fr":"Hanche","en":"Hip"},"categories":[{"id":"hip-dysfunctions","kind":"dysfunction","name":{"fr":"Dysfonctions","en":"Dysfunctions"},"children":[{"id":"mobility","name":{"fr":"mobility fr","en":"mobility en"},"children":[{"id":"flexion","name":{"fr":"flexion fr","en":"flexion en"}},{"id":"extension","name":{"fr":"extension fr","en":"extension en"}}]},{"id":"pain","name":{"fr":"pain fr","en":"pain en"}}]},{"id":"anamnesis","kind":"anamnesis","name":{"fr":"Anamnèse","en":"Anamnesis"},"children":[{"id":"trauma","name":{"fr":"trauma fr","en":"trauma en"}}]}]},{"id":"neck","name":{"fr":"Cou","en":"Neck"},"categories":[{"id":"neck-dysfunctions","kind":"dysfunction","name":{"fr":"Dysfonctions","en":"Dysfunctions"},"children":[{"id":"stiffness","name":{"fr":"stiffness fr","en":"stiffness en"}},{"id":"vet","name":{"fr":"vet fr","en":"vet en"},"requires_vet_referral":true}]}]}]},"references":[{"id":"atlas","type":"book","citation":"Atlas of anatomy","url":null,"doi":null},{"id":"paper","type":"journal","citation":"A paper","url":null,"doi":"10.1/x"}],"legacy_id_map":{"views":{"head":"head"},"annotations":{"legacy-hip":"hip","legacy-neck":"neck"},"categories":{},"finding_nodes":{},"assets":{}},"cases":[{"probe":"*","changes_file":{"changes":[{"id":"CHG-001","level":"C","kind":"correction","title":{"fr":"Titre *","en":"Title"},"rationale":"Raison * fin.","reference_ids":[],"question":"Question * ?","ops":[{"op":"add","target":"document","field":"references","value":{"id":"probe-ref","type":"web","citation":"Citation *","url":null,"doi":null}},{"op":"cite","target":"finding:hip/hip-dysfunctions/mobility","reference_ids":["probe-ref"]},{"op":"set","target":"finding:hip/hip-dysfunctions/mobility","field":"name.en","value":"Label *"}]}]},"changelog_raw":"# Journal des changements : révision de travail\n\nGénéré par `pnpm import:equine` : import historique (`legacy-import/`) puis changements rédigés (`curation/changes.json`). Ne pas modifier à la main : relancer la commande.\n\nNiveaux : A = erreur démontrée, B = amélioration étayée, C = point incertain. Les niveaux B et C demandent une confirmation professionnelle.\n\n## Comparaison quantitative\n\n| Indicateur | Avant | Après |\n| --- | --- | --- |\n| Vues | 2 | 2 |\n| Dessins SVG distincts | 1 | 1 |\n| Annotations | 3 | 3 |\n| Annotations (point) | 1 | 1 |\n| Annotations (zone) | 1 | 1 |\n| Annotations (detail_trigger) | 1 | 1 |\n| Annotations, revue (inherited) | 3 | 3 |\n| Annotations, revue (reviewed) | 0 | 0 |\n| Annotations, revue (to_confirm) | 0 | 0 |\n| Catégories d'annotation | 2 | 2 |\n| Zones de constats | 2 | 2 |\n| Catégories de constats | 3 | 3 |\n| Nœuds (catégories incluses) | 10 | 10 |\n| Feuilles | 6 | 6 |\n| Renvois vétérinaires | 1 | 1 |\n| Nœuds, revue (inherited) | 10 | 9 |\n| Nœuds, revue (reviewed) | 0 | 0 |\n| Nœuds, revue (to_confirm) | 0 | 1 |\n| Descriptions | 0 | 0 |\n| Descriptions en français seulement | 0 | 0 |\n| Références bibliographiques | 0 | 3 |\n| Nœuds cités | 0 | 1 |\n| Régions vertébrales avec plage documentée | 0 | 0 |\n\n## Migration des bilans v2\n\n| Nœuds | Nombre |\n| --- | --- |\n| Nœuds du catalogue historique | 10 |\n| Chemin identique | 10 |\n| Chemin renommé ou déplacé (suivi des renommages) | 0 |\n| Relogé sous une autre catégorie (correspondance unique) | 0 |\n| Retiré : le bilan garde le constat avec ses libellés figés | 0 |\n\n## Niveau A : erreurs démontrées\n\nAucun changement de ce niveau.\n\n## Niveau B : améliorations étayées (confirmatioLine truncated
@@ -61,6 +61,33 @@ const PATTERNS = [
'a|b',
'<b>gras</b>',
'[lien](https://example.org/x)',
'[a](<b>)',
'[a]( b )',
'[a](b "t")',
'[a](b (t))',
'[a](b&amp;c)',
'[a](b\\)c)',
'[a](https://x.org/a(b)c)',
']( )',
'![img](x.png)',
'[a][b]',
'<http://a&amp;b>',
'<https://example.org/x>',
'<a@b.co>',
'[[ a ]]',
'[[a]]',
'&#42;',
'&ast;',
'&#x2A;',
'&#95;',
'&lowbar;',
'&eacute;',
'doi 10.1/x<0697:toih>2.0',
'中_中',
'ア_ア',
'한_한',
'é_é',
'[a]( https://x.org )',
'&amp;',
'# titre',
'1. item',