|grep ...|awk ...
And the text of the document gets processed. But if you want to mess with the dom you could:
Html.Body | sed ... | jq ...
|grep ...|awk ...
And the text of the document gets processed. But if you want to mess with the dom you could:
Html.Body | sed ... | jq ...
The "configuration" is just more code that gets compiled in on loading. It's a complete first class citizen unlike extensions for most software which is sandboxed in a separate language and can only see certain APIs.
In Nyxt, StumpWM, Emacs, and other Lisp software you can literally put bugfixes in your config, redefine existing functions, and generally do whatever the hell you want.
You could however, use a tool like External Application Button [0] in order to send the URL of the page to a script/program, which in turn can make the body of the page parsable by downloading the URL it gets, automating some action on it. I use it pretty often to automate downloads with yt-dlp or opening a picture directly in GIMP from the browser, but since you're invoking a bash/python/whatever script, the possibilities are basically endless.
[0]: https://github.com/andy-portmen/external-application-button
This works less well than it used to now that CMSs and blogs are now SPAs that render no text without javascript being enabled.
I’m curious about this comment. Surely this should be possible using accessibility hooks for a normal browser or in Nyxt via scripting, right?
(defun get-buffer-text (&optional buf)
(nyxt/mode/document:select-all buf)
(nyxt/mode/document:copy buf)
(trivial-clipboard:text))
(define-internal-page cmd-result (&key text) (:title "*Result*")
(spinneret:with-html-string
(dolist (line (str:split #\newline text))
(:p line))))
(define-command-global buf-text-to-pipe-cmd (&optional buf cmd)
(let* ((buf (or buf (nyxt:current-buffer)))
(safe-text (uiop:escape-sh-token (get-buffer-text buf)))
(cmd (or cmd (prompt1 :prompt "cmd: " :sources 'prompter:raw-source)))
(cmd-output (uiop:run-program
`("bash" "-c" ,(str:concat "echo '" safe-text "' | " cmd))
:output :string)))
(nyxt:buffer-load-internal-page-focus 'cmd-result :text cmd-output)))
And then call the function like C-space buf-text-to-pipe-cmd and specify the commands to pipe to. Output will appear in a new buffer that can be further used as the source for piping.DOM handling would be a tad more laborous, but you can pick DOM elements from output of nyxt:document-model with CSS selectors using clss:select.