Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document standard tokens and provide examples #3104

Merged
merged 20 commits into from
Oct 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions extending.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ <h1>Language definitions</h1>

<dt>alias</dt>
<dd>This option can be used to define one or more aliases for the matched token. The result will be, that
the styles of the token and its aliases are combined. This can be useful, to combine the styling of a well known
token, which is already supported by most of the themes, with a semantically correct token name. The option
the styles of the token and its aliases are combined. This can be useful, to combine the styling of a <a href="/tokens.html">standard
token</a>, which is already supported by most of the themes, with a semantically correct token name. The option
can be set to a string literal or an array of string literals. In the following example the token
name <code>latex-equation</code> is not supported by any theme, but it will be highlighted the same as a string.
<pre><code class="language-javascript">{
Expand Down
7 changes: 4 additions & 3 deletions faq.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<script>var _gaq = [['_setAccount', 'UA-33746269-1'], ['_trackPageview']];</script>
<script src="https://www.google-analytics.com/ga.js" async></script>
</head>
<body>
<body class="language-none">

<header>
<div class="intro" data-src="assets/templates/header-main.html" data-type="text/html"></div>
Expand Down Expand Up @@ -95,14 +95,15 @@ <h1>How do I know which tokens I can style for every language?</h1>

<p>Language: <select id="language-select"></select></p>
<pre class="language-none" style="height: 30em"><code id="print-tokens-output"></code></pre>

<p>Additionally, you can find a list of standard tokens on <a href="/tokens.html">this page</a>.</p>
</section>

<section>
<h1>How can I use different highlighting for tokens with the same name in different languages?</h1>
<p>Just use a descendant selector, that includes the language class. The default <code>prism.css</code> does this, to have different colors for
JavaScript strings (which are very common) and CSS strings (which are relatively rare). Here’s that code, simplified to illustrate the technique:
<pre><code class="language-css">
.token.string {
<pre><code class="language-css">.token.string {
color: #690;
}

Expand Down
Loading