mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-20 17:15:51 +02:00
Allow Latex equations in homepage banners and part comment.
This commit is contained in:
parent
9dc5d325da
commit
562db6da06
5 changed files with 28 additions and 18 deletions
|
@ -811,7 +811,7 @@ div.dataTables_wrapper div.dataTables_info {
|
||||||
padding: 10px 10px;
|
padding: 10px 10px;
|
||||||
margin: 0 0 10px;
|
margin: 0 0 10px;
|
||||||
font-size: 17.5px;
|
font-size: 17.5px;
|
||||||
border-left: 5px solid #eee;
|
border-left: 5px solid #aaa;
|
||||||
}
|
}
|
||||||
|
|
||||||
.darkmode-layer {
|
.darkmode-layer {
|
||||||
|
|
|
@ -465,6 +465,19 @@ $(document).on("ajaxUI:start", function () {
|
||||||
//Bootstrapify objects
|
//Bootstrapify objects
|
||||||
$('table', this).addClass('table table-hover table-striped table-bordered');
|
$('table', this).addClass('table table-hover table-striped table-bordered');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Latex rendering have to be done after markdown parsing
|
||||||
|
$('.latex').each(function(index, element) {
|
||||||
|
//@ts-ignore
|
||||||
|
window.renderMathInElement(element, {
|
||||||
|
delimiters: [
|
||||||
|
{left: "$$", right: "$$", display: true},
|
||||||
|
{left: "$", right: "$", display: false},
|
||||||
|
{left: "\\(", right: "\\)", display: false},
|
||||||
|
{left: "\\[", right: "\\]", display: true}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//Configure markdown
|
//Configure markdown
|
||||||
|
@ -552,20 +565,6 @@ $(document).on("ajaxUI:reload", function() {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
//Register latex rendering
|
|
||||||
$(document).on("ajaxUI:reload ajaxUI:start", function() {
|
|
||||||
$('.latex').each(function(index, element) {
|
|
||||||
//@ts-ignore
|
|
||||||
window.renderMathInElement(element, {
|
|
||||||
delimiters: [
|
|
||||||
{left: "$$", right: "$$", display: true},
|
|
||||||
{left: "$", right: "$", display: false},
|
|
||||||
{left: "\\(", right: "\\)", display: false},
|
|
||||||
{left: "\\[", right: "\\]", display: true}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
//Need for proper body padding, with every navbar height
|
//Need for proper body padding, with every navbar height
|
||||||
$(window).resize(function () {
|
$(window).resize(function () {
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
Welcome to Part-DB.
|
Welcome to Part-DB.
|
||||||
|
|
||||||
<small>If you want to change this banner, edit `config/banner.md` file or set the `BANNER` environment variable.</small>
|
<small>If you want to change this banner, edit `config/banner.md` file or set the `BANNER` environment variable.</small>
|
||||||
|
|
||||||
|
<blockquote class="pb-0">
|
||||||
|
<p style="font-size: 12px">
|
||||||
|
And God said <br>
|
||||||
|
$\nabla \cdot \vec{D} = \rho$,
|
||||||
|
$\nabla \cdot \vec{B} = 0$,
|
||||||
|
$\nabla \times \vec{E} = -\frac{\partial \vec{B}}{\partial t}$,
|
||||||
|
$\nabla \times \vec{H} = \vec{j} + \frac{\partial \vec{D}}{\partial t}$, <br>
|
||||||
|
and then there was light.
|
||||||
|
</p>
|
||||||
|
</blockquote>
|
|
@ -101,7 +101,7 @@
|
||||||
<div class="tab-content" id="myTabContent">
|
<div class="tab-content" id="myTabContent">
|
||||||
{% if part.comment is not empty %}
|
{% if part.comment is not empty %}
|
||||||
<div class="tab-pane fade show" id="comment" role="tabpanel" aria-labelledby="home-tab">
|
<div class="tab-pane fade show" id="comment" role="tabpanel" aria-labelledby="home-tab">
|
||||||
<div class="container-fluid mt-2">
|
<div class="container-fluid mt-2 latex">
|
||||||
{{ part.comment|markdown }}
|
{{ part.comment|markdown }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
</h4>
|
</h4>
|
||||||
{% if banner is not empty %}
|
{% if banner is not empty %}
|
||||||
<hr>
|
<hr>
|
||||||
<div>
|
<div class="latex">
|
||||||
<h5>{{ banner | markdown }}</h5>
|
<h5>{{ banner | markdown }}</h5>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue