1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-23 00:30:05 +00:00

Add underline and hilight support to Markdown renderer

++underline++ and ==hilight==, also known as <ins> and <mark>

The markdown-it-ins and markdown-it-mark are not available
on CF's cdnjs, so selfhost them. (They are on jsdeliver, but
it's better to rely on our own host than add another 3rd party.)

Improves visibility (color) of <mark> a bit as well.
This commit is contained in:
TheAMM 2017-12-10 22:59:18 +02:00
parent 4cdf7f4ab3
commit c2513fd931
5 changed files with 11 additions and 2 deletions

View file

@ -571,3 +571,9 @@ td.report-action-column {
blockquote { blockquote {
font-size: inherit; font-size: inherit;
} }
/* Make <mark>s a bit more prominent */
mark, .mark {
background-color: #fff6c9;
padding: .2em;
}

Binary file not shown.

Binary file not shown.

View file

@ -207,7 +207,7 @@ var markdownOptions = {
linkify: true, linkify: true,
typographer: true typographer: true
} }
var markdown = window.markdownit(markdownOptions); var markdown = window.markdownit(markdownOptions).use(window.markdownitIns).use(window.markdownitMark);
markdown.renderer.rules.table_open = function (tokens, idx) { markdown.renderer.rules.table_open = function (tokens, idx) {
// Format tables nicer (bootstrap). Force auto-width (default is 100%) // Format tables nicer (bootstrap). Force auto-width (default is 100%)
return '<table class="table table-striped table-bordered" style="width: auto;">'; return '<table class="table table-striped table-bordered" style="width: auto;">';

View file

@ -44,6 +44,9 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/markdown-it/8.3.1/markdown-it.min.js" integrity="sha256-3WZyZQOe+ql3pLo90lrkRtALrlniGdnf//gRpW0UQks=" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/markdown-it/8.3.1/markdown-it.min.js" integrity="sha256-3WZyZQOe+ql3pLo90lrkRtALrlniGdnf//gRpW0UQks=" crossorigin="anonymous"></script>
<!-- markdown-it extensions (self-hosted because no cdnjs releases) -->
<script src="{{ static_cachebuster('js/lib/markdown-it-ins.min.js') }}"></script>
<script src="{{ static_cachebuster('js/lib/markdown-it-mark.min.js') }}"></script>
<!-- Modified to not apply border-radius to selectpickers and stuff so our navbar looks cool --> <!-- Modified to not apply border-radius to selectpickers and stuff so our navbar looks cool -->
<script src="{{ static_cachebuster('js/bootstrap-select.js') }}"></script> <script src="{{ static_cachebuster('js/bootstrap-select.js') }}"></script>
<script src="{{ static_cachebuster('js/main.js') }}"></script> <script src="{{ static_cachebuster('js/main.js') }}"></script>