1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-06-27 16:36:00 +00:00

Extract Highlight controller

This commit is contained in:
Yassine Guedidi 2025-03-01 01:33:48 +01:00
parent 3125eb43ad
commit 503b82ea13
6 changed files with 22 additions and 22 deletions

View file

@ -0,0 +1,11 @@
import { Controller } from '@hotwired/stimulus';
import 'highlight.js/styles/atom-one-light.css';
import hljs from 'highlight.js';
export default class extends Controller {
connect() {
this.element.querySelectorAll('pre code').forEach((element) => {
hljs.highlightElement(element);
});
}
}

View file

@ -21,9 +21,6 @@ import '@fontsource/eb-garamond';
import '@fontsource/montserrat'; import '@fontsource/montserrat';
import '@fontsource/oswald'; import '@fontsource/oswald';
/* Highlight */
import './js/highlight';
/* Tools */ /* Tools */
import { import {
savePercent, retrievePercent, initPreviewText, savePercent, retrievePercent, initPreviewText,

View file

@ -1,8 +0,0 @@
import 'highlight.js/styles/atom-one-light.css';
import hljs from 'highlight.js';
window.addEventListener('load', () => {
document.querySelectorAll('pre').forEach((element) => {
hljs.highlightElement(element);
});
});

View file

@ -18,14 +18,14 @@
<img data-controller="qrcode" data-qrcode-url-value="{{ qr_code|raw }}" class="hide-on-med-and-down" /> <img data-controller="qrcode" data-qrcode-url-value="{{ qr_code|raw }}" class="hide-on-med-and-down" />
</p> </p>
<p> <div data-controller="highlight">
{{ 'config.otp.app.two_factor_code_description_5'|trans }} <pre>{{ secret }}</pre> {{ 'config.otp.app.two_factor_code_description_5'|trans }} <pre><code>{{ secret }}</code></pre>
</p> </div>
</li> </li>
<li> <li>
<p>{{ 'config.otp.app.two_factor_code_description_3'|trans }}</p> <p>{{ 'config.otp.app.two_factor_code_description_3'|trans }}</p>
<p><pre>{{ backupCodes|join("\n") }}</pre></p> <div data-controller="highlight"><pre><code>{{ backupCodes|join("\n") }}</code></pre></div>
</li> </li>
<li> <li>
<p>{{ 'config.otp.app.two_factor_code_description_4'|trans }}</p> <p>{{ 'config.otp.app.two_factor_code_description_4'|trans }}</p>

View file

@ -12,16 +12,16 @@
<p>{{ 'developer.howto.description.paragraph_2'|trans }}</p> <p>{{ 'developer.howto.description.paragraph_2'|trans }}</p>
<p>{{ 'developer.howto.description.paragraph_3'|trans({'%link%': path('developer_create_client')})|raw }}</p> <p>{{ 'developer.howto.description.paragraph_3'|trans({'%link%': path('developer_create_client')})|raw }}</p>
<p>{{ 'developer.howto.description.paragraph_4'|trans }}</p> <p>{{ 'developer.howto.description.paragraph_4'|trans }}</p>
<p> <div data-controller="highlight">
<pre><code class="language-bash">http POST {{ wallabag_url }}/oauth/v2/token \ <pre><code class="language-bash">http POST {{ wallabag_url }}/oauth/v2/token \
grant_type=password \ grant_type=password \
client_id=12_5um6nz50ceg4088c0840wwc0kgg44g00kk84og044ggkscso0k \ client_id=12_5um6nz50ceg4088c0840wwc0kgg44g00kk84og044ggkscso0k \
client_secret=3qd12zpeaxes8cwg8c0404g888co4wo8kc4gcw0occww8cgw4k \ client_secret=3qd12zpeaxes8cwg8c0404g888co4wo8kc4gcw0occww8cgw4k \
username=yourUsername \ username=yourUsername \
password=yourPassw0rd</code></pre> password=yourPassw0rd</code></pre>
</p> </div>
<p>{{ 'developer.howto.description.paragraph_5'|trans }}</p> <p>{{ 'developer.howto.description.paragraph_5'|trans }}</p>
<p> <div data-controller="highlight">
<pre><code class="language-bash">HTTP/1.1 200 OK <pre><code class="language-bash">HTTP/1.1 200 OK
Cache-Control: no-store, private Cache-Control: no-store, private
Connection: close Connection: close
@ -39,12 +39,12 @@ X-Powered-By: PHP/5.5.9-1ubuntu4.13
"scope": null, "scope": null,
"token_type": "bearer" "token_type": "bearer"
}</code></pre> }</code></pre>
</p> </div>
<p>{{ 'developer.howto.description.paragraph_6'|trans }}</p> <p>{{ 'developer.howto.description.paragraph_6'|trans }}</p>
<p> <div data-controller="highlight">
<pre><code class="language-bash">http GET {{ wallabag_url }}/api/entries.json \ <pre><code class="language-bash">http GET {{ wallabag_url }}/api/entries.json \
"Authorization:Bearer ZWFjNjA3ZWMwYWVmYzRkYTBlMmQ3NTllYmVhOGJiZDE0ZTg1NjE4MjczOTVlNzM0ZTRlMWQ0MmRlMmYwNTk5Mw"</code></pre> "Authorization:Bearer ZWFjNjA3ZWMwYWVmYzRkYTBlMmQ3NTllYmVhOGJiZDE0ZTg1NjE4MjczOTVlNzM0ZTRlMWQ0MmRlMmYwNTk5Mw"</code></pre>
</p> </div>
<p>{{ 'developer.howto.description.paragraph_7'|trans }}</p> <p>{{ 'developer.howto.description.paragraph_7'|trans }}</p>
<p>{{ 'developer.howto.description.paragraph_8'|trans({'%link%': path('nelmio_api_doc.swagger_ui')})|raw }}</p> <p>{{ 'developer.howto.description.paragraph_8'|trans({'%link%': path('nelmio_api_doc.swagger_ui')})|raw }}</p>
<p><a href="{{ path('developer') }}" class="waves-effect waves-light grey btn">{{ 'developer.howto.back'|trans }}</a></p> <p><a href="{{ path('developer') }}" class="waves-effect waves-light grey btn">{{ 'developer.howto.back'|trans }}</a></p>

View file

@ -326,7 +326,7 @@
{% endif %} {% endif %}
</aside> </aside>
<article{% if entry.language is defined and entry.language is not null %} lang="{{ entry.getHTMLLanguage() }}"{% endif %}> <article{% if entry.language is defined and entry.language is not null %} lang="{{ entry.getHTMLLanguage() }}"{% endif %} data-controller="highlight">
{{ entry.content|raw }} {{ entry.content|raw }}
</article> </article>