feat: new markdown style

This commit is contained in:
Baoshuo Ren 2022-09-18 20:47:21 +08:00
parent bb5de2a00e
commit d2a07c5265
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
5 changed files with 12 additions and 6 deletions

View File

@ -267,9 +267,10 @@ $('#contest-countdown').countdown(<?= $contest['end_time']->getTimestamp() - UOJ
<li class="nav-item"><a class="nav-link" href="/contest/<?= $contest['id'] ?>" role="tab"><?= UOJLocale::get('contests::back to the contest') ?></a></li> <li class="nav-item"><a class="nav-link" href="/contest/<?= $contest['id'] ?>" role="tab"><?= UOJLocale::get('contests::back to the contest') ?></a></li>
<?php endif ?> <?php endif ?>
</ul> </ul>
<link rel="stylesheet" type="text/css" href="<?= HTML::url('/css/markdown.css') ?>">
<div class="tab-content"> <div class="tab-content">
<div class="tab-pane active" id="tab-statement"> <div class="tab-pane active" id="tab-statement">
<article class="top-buffer-md"><?= $problem_content['statement'] ?></article> <article class="top-buffer-md markdown-body"><?= $problem_content['statement'] ?></article>
</div> </div>
<div class="tab-pane" id="tab-submit-answer"> <div class="tab-pane" id="tab-submit-answer">
<div class="top-buffer-sm"></div> <div class="top-buffer-sm"></div>

View File

@ -214,7 +214,8 @@ EOD
ob_start(); ob_start();
if ($this->type == 'blog') { if ($this->type == 'blog') {
echoUOJPageHeader('博客预览', array('ShowPageHeader' => false, 'REQUIRE_LIB' => array('mathjax' => '', 'shjs' => ''))); echoUOJPageHeader('博客预览', array('ShowPageHeader' => false, 'REQUIRE_LIB' => array('mathjax' => '', 'shjs' => '')));
echo '<article>'; echo '<link rel="stylesheet" type="text/css" href="' . HTML::url('/css/markdown.css') . '">';
echo '<article class="markdown-body">';
echo $this->post_data['content']; echo $this->post_data['content'];
echo '</article>'; echo '</article>';
echoUOJPageFooter(array('ShowPageFooter' => false)); echoUOJPageFooter(array('ShowPageFooter' => false));

View File

@ -14,13 +14,14 @@
$blog_type = $blog['type'] == 'B' ? 'post' : 'slide'; $blog_type = $blog['type'] == 'B' ? 'post' : 'slide';
?> ?>
<link rel="stylesheet" type="text/css" href="<?= HTML::url('/css/markdown.css') ?>">
<h2><?= $extra_text ?><a class="header-a" href="<?= HTML::blog_url(UOJContext::userid(), '/post/'.$blog['id']) ?>"><?= $blog['title'] ?></a></h2> <h2><?= $extra_text ?><a class="header-a" href="<?= HTML::blog_url(UOJContext::userid(), '/post/'.$blog['id']) ?>"><?= $blog['title'] ?></a></h2>
<div><?= $blog['post_time'] ?> <strong>By</strong> <?= getUserLink($blog['poster']) ?></div> <div><?= $blog['post_time'] ?> <strong>By</strong> <?= getUserLink($blog['poster']) ?></div>
<?php if (!$show_title_only): ?> <?php if (!$show_title_only): ?>
<div class="card mb-4"> <div class="card mb-4">
<div class="card-body"> <div class="card-body">
<?php if ($blog_type == 'post'): ?> <?php if ($blog_type == 'post'): ?>
<article><?= $content ?></article> <article class="markdown-body"><?= $content ?></article>
<?php elseif ($blog_type == 'slide'): ?> <?php elseif ($blog_type == 'slide'): ?>
<article> <article>
<div class="embed-responsive embed-responsive-16by9"> <div class="embed-responsive embed-responsive-16by9">

2
web/css/markdown.css Normal file

File diff suppressed because one or more lines are too long

View File

@ -11,6 +11,10 @@ body {
min-height: 250px; min-height: 250px;
} }
.uoj-content img {
max-width: 100%;
}
.uoj-footer { .uoj-footer {
text-align: center; text-align: center;
margin-top: 20px; margin-top: 20px;
@ -46,9 +50,6 @@ a sub {
text-indent: 2em; text-indent: 2em;
} }
article p {
text-indent: 2em;
}
.markdown-editor-out p { .markdown-editor-out p {
text-indent: 2em; text-indent: 2em;
word-break: break-all; word-break: break-all;