summaryrefslogtreecommitdiffstats
path: root/devtools/docs/user/view_source
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /devtools/docs/user/view_source
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--devtools/docs/user/view_source/index.rst90
-rw-r--r--devtools/docs/user/view_source/view_source_context_menu.pngbin0 -> 4859 bytes
-rw-r--r--devtools/docs/user/view_source/view_source_error.pngbin0 -> 3374 bytes
3 files changed, 90 insertions, 0 deletions
diff --git a/devtools/docs/user/view_source/index.rst b/devtools/docs/user/view_source/index.rst
new file mode 100644
index 0000000000..12f7983dc8
--- /dev/null
+++ b/devtools/docs/user/view_source/index.rst
@@ -0,0 +1,90 @@
+===========
+View Source
+===========
+
+View Source lets you look at the HTML or XML source for the page you're viewing. To activate View Source:
+
+- context-click in the page and select *View Page Source*
+- press :kbd:`Ctrl` + :kbd:`U` on Windows and Linux, or :kbd:`Cmd` + :kbd:`U` on macOS
+
+The command opens a new tab with the source for the current page.
+
+View Source features
+********************
+
+View Source has three additional features, which can be accessed from the context menu in the View Source tab:
+
+.. image:: view_source_context_menu.png
+ :class: center
+
+Go to Line
+ Scrolls to the specified line. If the number is higher than the lines in a file, you receive an error message.
+Wrap Long Lines (toggle)
+ Wraps long lines to the width of the page.
+Syntax Highlighting (toggle)
+ Applies syntax highlighting to the code.When syntax highlighting is on, View Source also highlights parsing errors in red. Hovering your mouse over errors displays a tooltip explaining the error.
+
+.. image:: view_source_error.png
+ :class: border
+
+
+This feature is useful when you're looking for HTML errors.
+
+To access Go to Line from the keyboard, press :kbd:`Control` + :kbd:`Option` + :kbd:`L` on macOS, or :kbd:`Alt` + :kbd:`Shift` + :kbd:`L` on Windows or Linux.
+
+
+Link to a line number
+*********************
+
+It is possible to link to a particular line, by adding the #lineNNN anchor to the url the browser will jump to the NNN line.
+
+For example view-source:https://www.mozilla.org/#line100
+
+
+View Selection Source
+*********************
+
+If you select part of a web page and context-click, you'll see a context menu item labeled "View Selection Source", that behaves just like "View Page Source", except you only see the source for the selection.
+
+
+View MathML Source
+******************
+
+If you context-click while the mouse is over some `MathML <https://developer.mozilla.org/en-US/docs/Web/MathML>`_, you'll see a context menu item labeled "View MathML Source": click it to see the MathML source.
+
+
+Limitations of View Source
+**************************
+
+There are limitations to what View Source does for you that you need to be aware of.
+
+Error reporter ≠ validator
+--------------------------
+
+View Source only reports parsing errors, **not** HTML validity errors. For example, putting a `div <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div>`_ element as a child of a `ul <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul>`_ element isn't a parse error, but it **is not** valid HTML. Therefore, this error will not be flagged in View Source. If you want to check that HTML is valid, you should use an HTML validator, such as `the one offered by W3C <https://validator.w3.org/>`_.
+
+Not all parse errors are reported
+---------------------------------
+
+Even though all the reported errors are parse errors according to the HTML specification, not all parse errors are reported by View Source. Among the errors that don't get reported:
+
+
+- Bytes that are illegal according to the document's encoding aren't marked as errors.
+- Forbidden characters aren't reported as errors.
+- Errors related to the end-of-file aren't reported.
+- Tree builder errors relating to text (as opposed to tags, comments, or doctypes) aren't reported.
+- Parse errors related to ``xmlns`` attributes aren't reported.
+
+
+XML syntax highlighting
+***********************
+
+View Source uses the HTML tokenizer when highlighting XML source. While the tokenizer has support for processing instructions when highlighting XML source, that's the only XML-specific capability provided. Because of this, doctypes that have an internal subset are not highlighted correctly, and entity references to custom entities are also not highlighted correctly.
+
+This mishighlighting can be seen by viewing the source of Firefox chrome files (such as XUL documents). However, this shouldn't be a problem in practice when viewing typical XML files.
+
+
+See also
+********
+
+- `HTML5 Parser-Based View Source Syntax Highlighting <https://hsivonen.iki.fi/view-source/>`_ (Blog post)
diff --git a/devtools/docs/user/view_source/view_source_context_menu.png b/devtools/docs/user/view_source/view_source_context_menu.png
new file mode 100644
index 0000000000..c0f2039997
--- /dev/null
+++ b/devtools/docs/user/view_source/view_source_context_menu.png
Binary files differ
diff --git a/devtools/docs/user/view_source/view_source_error.png b/devtools/docs/user/view_source/view_source_error.png
new file mode 100644
index 0000000000..a38c932f9b
--- /dev/null
+++ b/devtools/docs/user/view_source/view_source_error.png
Binary files differ