Added h1 thru h6 bbcodes.

This commit is contained in:
flash 2023-02-12 03:50:08 +00:00
parent d423c53cde
commit 5760e15df5
8 changed files with 121 additions and 0 deletions

31
assets/css/misuzu/bb.css Normal file
View file

@ -0,0 +1,31 @@
.bb-h1, .bb-h2,
.bb-h3, .bb-h4,
.bb-h5, .bb-h6 {
font-weight: 700;
line-height: 1.5em;
display: inline-block;
width: 100%;
margin-bottom: .25em;
}
.bb-h1 {
font-size: 2em;
border-bottom: 1px solid var(--accent-colour);
}
.bb-h2 {
font-size: 1.5em;
border-bottom: 1px solid var(--accent-colour);
}
.bb-h3 {
font-size: 1.25em;
}
.bb-h4 {
font-size: 1em;
}
.bb-h5 {
font-size: 0.875em;
}
.bb-h6 {
font-size: 0.85em;
color: var(--accent-colour);
}

View file

@ -19,6 +19,12 @@ class BBCodeParser implements ParserInterface {
new Tags\VideoTag,
// Basic markup
new Tags\H1Tag,
new Tags\H2Tag,
new Tags\H3Tag,
new Tags\H4Tag,
new Tags\H5Tag,
new Tags\H6Tag,
new Tags\BoldTag,
new Tags\ItalicsTag,
new Tags\UnderlineTag,

View file

@ -0,0 +1,14 @@
<?php
namespace Misuzu\Parsers\BBCode\Tags;
use Misuzu\Parsers\BBCode\BBCodeSimpleTag;
final class H1Tag extends BBCodeSimpleTag {
public function getPattern(): string {
return "/\[h1\](.+?)\[\/h1\]/";
}
public function getReplacement(): string {
return '<h1 class="bb-h1">$1</h1>';
}
}

View file

@ -0,0 +1,14 @@
<?php
namespace Misuzu\Parsers\BBCode\Tags;
use Misuzu\Parsers\BBCode\BBCodeSimpleTag;
final class H2Tag extends BBCodeSimpleTag {
public function getPattern(): string {
return "/\[h2\](.+?)\[\/h2\]/";
}
public function getReplacement(): string {
return '<h2 class="bb-h2">$1</h2>';
}
}

View file

@ -0,0 +1,14 @@
<?php
namespace Misuzu\Parsers\BBCode\Tags;
use Misuzu\Parsers\BBCode\BBCodeSimpleTag;
final class H3Tag extends BBCodeSimpleTag {
public function getPattern(): string {
return "/\[h3\](.+?)\[\/h3\]/";
}
public function getReplacement(): string {
return '<h3 class="bb-h3">$1</h3>';
}
}

View file

@ -0,0 +1,14 @@
<?php
namespace Misuzu\Parsers\BBCode\Tags;
use Misuzu\Parsers\BBCode\BBCodeSimpleTag;
final class H4Tag extends BBCodeSimpleTag {
public function getPattern(): string {
return "/\[h4\](.+?)\[\/h4\]/";
}
public function getReplacement(): string {
return '<h4 class="bb-h4">$1</h4>';
}
}

View file

@ -0,0 +1,14 @@
<?php
namespace Misuzu\Parsers\BBCode\Tags;
use Misuzu\Parsers\BBCode\BBCodeSimpleTag;
final class H5Tag extends BBCodeSimpleTag {
public function getPattern(): string {
return "/\[h5\](.+?)\[\/h5\]/";
}
public function getReplacement(): string {
return '<h5 class="bb-h5">$1</h5>';
}
}

View file

@ -0,0 +1,14 @@
<?php
namespace Misuzu\Parsers\BBCode\Tags;
use Misuzu\Parsers\BBCode\BBCodeSimpleTag;
final class H6Tag extends BBCodeSimpleTag {
public function getPattern(): string {
return "/\[h6\](.+?)\[\/h6\]/";
}
public function getReplacement(): string {
return '<h6 class="bb-h6">$1</h6>';
}
}