diff options
Diffstat (limited to 'files/pl/tools/view_source/index.html')
-rw-r--r-- | files/pl/tools/view_source/index.html | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/files/pl/tools/view_source/index.html b/files/pl/tools/view_source/index.html new file mode 100644 index 0000000000..206d54d7da --- /dev/null +++ b/files/pl/tools/view_source/index.html @@ -0,0 +1,83 @@ +--- +title: View Source +slug: Tools/View_source +translation_of: Tools/View_source +original_slug: Narzędzia/View_source +--- +<div>{{ToolsSidebar}}</div> + +<p>View Source lets you look at the HTML or XML source for the page you're viewing. To activate View Source:</p> + +<ul> + <li>context-click in the page and select <em>View Page Source</em></li> + <li>press <kbd>Ctrl</kbd> + <kbd>U</kbd> on Windows and Linux, or <kbd>Cmd</kbd> + <kbd>U</kbd> on macOS</li> +</ul> + +<p>The command opens a new tab with the source for the current page.</p> + +<h2 id="View_Source_features">View Source features</h2> + +<p>View Source has three additional features, which can be accessed from the context menu in the View Source tab:</p> + +<p><img alt="" src="https://mdn.mozillademos.org/files/16909/view_source_context_menu.png" style="display: block; height: 359px; margin: 0 auto; width: 225px;"></p> + +<dl> + <dt>Go to Line</dt> + <dd>Scrolls to the specified line. If the number is higher than the lines in a file, you receive an error message.</dd> + <dt>Wrap Long Lines (toggle)</dt> + <dd>Wraps long lines to the width of the page.</dd> + <dt>Syntax Highlighting (toggle)</dt> + <dd>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.</dd> +</dl> + +<p><img alt="" src="https://mdn.mozillademos.org/files/16910/view_source_error.png" style="border: 1px solid black; display: block; margin: 0 auto;"></p> + +<p>This feature is useful when you're looking for HTML errors.</p> + +<p>To access Go to Line from the keyboard, press <kbd>Control</kbd> + <kbd>Option</kbd> + <kbd>L</kbd> on macOS, or <kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>L</kbd> on Windows or Linux.</p> + +<h2 id="Link_to_a_line_number">Link to a line number</h2> + +<p>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.</p> + +<p>For example <a>view-source:https://www.mozilla.org/#line100</a></p> + +<h2 id="View_Selection_Source">View Selection Source</h2> + +<p>If you select part of a web page and conext-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.</p> + +<h2 id="View_MathML_Source">View MathML Source</h2> + +<p>If you context-click while the mouse is over some <a href="/en-US/docs/Web/MathML">MathML</a>, you'll see a context menu item labeled "View MathML Source": click it to see the MathML source.</p> + +<h2 id="Limitations_of_View_Source">Limitations of View Source</h2> + +<p>There are limitations to what View Source does for you that you need to be aware of.</p> + +<h3 id="Error_reporter_≠_validator">Error reporter ≠ validator</h3> + +<p>View Source only reports parsing errors, <strong>not</strong> HTML validity errors. For example, putting a {{ HTMLElement("div") }} element as a child of a {{ HTMLElement("ul") }} element isn't a parse error, but it <strong>is not</strong> 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 <a class="external" href="http://validator.w3.org/" title="http://validator.w3.org/">the one offered by W3C</a>.</p> + +<h3 id="Not_all_parse_errors_are_reported">Not all parse errors are reported</h3> + +<p>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:</p> + +<ul> + <li>Bytes that are illegal according to the document's encoding aren't marked as errors.</li> + <li>Forbidden characters aren't reported as errors.</li> + <li>Errors related to the end-of-file aren't reported.</li> + <li>Tree builder errors relating to text (as opposed to tags, comments, or doctypes) aren't reported.</li> + <li>Parse errors related to <code>xmlns</code> attributes aren't reported.</li> +</ul> + +<h2 id="XML_syntax_highlighting">XML syntax highlighting</h2> + +<p>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.</p> + +<p>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.</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li><a class="external" href="http://hsivonen.iki.fi/view-source/" title="http://hsivonen.iki.fi/view-source/">HTML5 Parser-Based View Source Syntax Highlighting</a> (Blog post)</li> +</ul> |