tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

index.rst (4057B)


      1 ===========
      2 View Source
      3 ===========
      4 
      5 View Source lets you look at the HTML or XML source for the page you're viewing. To activate View Source:
      6 
      7 - context-click in the page and select *View Page Source*
      8 - press :kbd:`Ctrl` + :kbd:`U` on Windows and Linux, or :kbd:`Cmd` + :kbd:`U` on macOS
      9 
     10 The command opens a new tab with the source for the current page.
     11 
     12 View Source features
     13 ********************
     14 
     15 View Source has three additional features, which can be accessed from the context menu in the View Source tab:
     16 
     17 .. image:: view_source_context_menu.png
     18  :class: center
     19 
     20 Go to Line
     21  Scrolls to the specified line. If the number is higher than the lines in a file, you receive an error message.
     22 Wrap Long Lines (toggle)
     23  Wraps long lines to the width of the page.
     24 Syntax Highlighting (toggle)
     25  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.
     26 
     27 .. image:: view_source_error.png
     28  :class: border
     29 
     30 
     31 This feature is useful when you're looking for HTML errors.
     32 
     33 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.
     34 
     35 
     36 Link to a line number
     37 *********************
     38 
     39 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.
     40 
     41 For example view-source:https://www.mozilla.org/#line100
     42 
     43 
     44 View Selection Source
     45 *********************
     46 
     47 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.
     48 
     49 
     50 View MathML Source
     51 ******************
     52 
     53 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.
     54 
     55 
     56 Limitations of View Source
     57 **************************
     58 
     59 There are limitations to what View Source does for you that you need to be aware of.
     60 
     61 Error reporter ≠ validator
     62 --------------------------
     63 
     64 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/>`_.
     65 
     66 Not all parse errors are reported
     67 ---------------------------------
     68 
     69 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:
     70 
     71 
     72 - Bytes that are illegal according to the document's encoding aren't marked as errors.
     73 - Forbidden characters aren't reported as errors.
     74 - Errors related to the end-of-file aren't reported.
     75 - Tree builder errors relating to text (as opposed to tags, comments, or doctypes) aren't reported.
     76 - Parse errors related to ``xmlns`` attributes aren't reported.
     77 
     78 
     79 XML syntax highlighting
     80 ***********************
     81 
     82 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.
     83 
     84 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.
     85 
     86 
     87 See also
     88 ********
     89 
     90 - `HTML5 Parser-Based View Source Syntax Highlighting <https://hsivonen.iki.fi/view-source/>`_ (Blog post)