Page warnings log their line only, never words or source (M-11)
A document can forge both a console message and its source (KaTeX's \errmessage, data: scripts, sourceURL, encoded paths), so the display handler logs a line number and nothing the page wrote. The page's own diagnostics reach the app over elyQuery: a missed reveal sends its line; the visual failure and diagram lines already did. A test calls the real handler and checks the captured log. Round 5 found only the missing test; it is added and mutation-checked, with no sixth review under the five-round cap. M-15 is new: the print page runs a document's scripts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4a2dcbb222
commit
c5cb153f72
13 files changed
+101
-30
No files matched your search
@@ -5,7 +5,9 @@ use std::path::{Path, PathBuf};
|
||||
use anyhow::{Result, bail};
|
||||
use ely_web_content::WebView;
|
||||
use gpui::App;
|
||||
use serde_json::json;
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use crate::view::Heading;
|
||||
|
||||
/// The app's Resources, else this build's `engines/content`.
|
||||
pub fn content() -> Result<PathBuf> {
|
||||
@@ -95,3 +97,18 @@ pub fn folder(view: &WebView, folder: &Path) {
|
||||
pub fn call(view: &WebView, name: &str, argument: &serde_json::Value) {
|
||||
view.run_js(&format!("ely.{name}({argument})"));
|
||||
}
|
||||
|
||||
/// Headings from the page; anything malformed is None.
|
||||
pub fn headings(items: &Value) -> Option<Vec<Heading>> {
|
||||
let heading = |item: &Value| {
|
||||
let level = item["level"]
|
||||
.as_u64()
|
||||
.filter(|level| (1..=6).contains(level))?;
|
||||
let title = item["title"].as_str()?.to_owned();
|
||||
Some(Heading {
|
||||
level: level as usize,
|
||||
title,
|
||||
})
|
||||
};
|
||||
items.as_array()?.iter().map(heading).collect()
|
||||
}
|
||||
Reference in new issue
Block a user