alignment fix

This commit is contained in:
randogoth 2025-10-20 17:56:30 +03:00
parent 8283dd45ea
commit ae26bb205b
7 changed files with 108 additions and 332 deletions

View file

@ -6,6 +6,7 @@
|___/\__,_|_|_\___|_||_\__|_\__,_|
%h Structa hinc vetitus factum
@ -37,151 +38,21 @@
%h Tractaque serpens arva quoque
_ _ _ _ _ _ ___ __
| |_ / | | || |___ __ _ __| (_)_ _ __ _ ( _ )__\ \
| ' \| | | __ / -_) _` / _` | | ' \/ _` | / _ \___| |
|_||_|_| |_||_\___\__,_\__,_|_|_||_\__, | \___/ | |
|___/ /_/
%h h2 Heading
%h h3 Heading
_ _ _ _ _ _ _
| |__ | || | | | | | ___ __ _ __| (_)_ __ __ _
| '_ \| || |_ | |_| |/ _ \/ _` |/ _` | | '_ \ / _` |
| | | |__ _| | _ | __/ (_| | (_| | | | | | (_| |
|_| |_| |_| |_| |_|\___|\__,_|\__,_|_|_| |_|\__, |
|___/
_ ____ _ _ _ _
| |__ | ___| | | | | ___ __ _ __| (_)_ __ __ _
| '_ \|___ \ | |_| |/ _ \/ _` |/ _` | | '_ \ / _` |
| | | |___) | | _ | __/ (_| | (_| | | | | | (_| |
|_| |_|____/ |_| |_|\___|\__,_|\__,_|_|_| |_|\__, |
|___/
_ __ _ _ _ _
| |__ / /_ | | | | ___ __ _ __| (_)_ __ __ _
| '_ \| '_ \ | |_| |/ _ \/ _` |/ _` | | '_ \ / _` |
| | | | (_) | | _ | __/ (_| | (_| | | | | | (_| |
|_| |_|\___/ |_| |_|\___|\__,_|\__,_|_|_| |_|\__, |
|___/
%h Horizontal Rules
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
%h Emphasis
%!THIS IS BOLD TEXT%t %bTHIS IS BOLD TEXT%t %!This is italic text%t %-
bThis is italic text%t Strikethrough
%h Blockquotes
Blockquotes can also be nested...
by using additional greater-than signs right next to each oth-
er...
or with spaces between arrows.
%h Lists
%h Unordered
+ Create a list by starting a line with `=+`=, `=-`=, or `=*`=
- Marker character change forces new list start:
* Ac tristique libero volutpat at
+ Facilisis in pretium nisl aliquet
- Nulla volutpat aliquam velit
+ Very easy
%h Ordered
1. Lorem ipsum dolor sit amet
2. Consectetur adipiscing elit
3. Integer molestie lorem at massa
%h Code
Inline `=code`=
Indented code
`=
// Some comments
line 1 of code
line 2 of code
line 3 of code
`=
Block code "fences"
`=
Sample text here...
`=
Syntax highlighting
`=
var foo = function (bar) {
return bar++;
};
console.log(foo(5));
`=
%h Links
link text (<http://dev.nodeca.com>)
link with title (<http://nodeca.github.io/pica/demo/ "title text!">)
%h Images
Minion (<https://octodex.github.com/images/minion.png>) Stormtroopocat
(<https://octodex.github.com/images/stormtroopocat.jpg "The Stormtroo-
pocat">)
<>=======()
(/\___ /|\\ ()==========<>_
\_/ | \\ //|\ ______/ \)
\_| \\ // | \_/
\|\/|\_ // /\/
(oo)\ \_// /
//_/\_\/ / |
@@/ |=\ \ |
\_=\_ \ |
\==\ \|\_ snd
__(\===\( )\
(((~) __(_/ |
(((~) \ /
______/ /
'------'
Inprudens dum memor alma, casses dedi Sinuessa iam quid adicit `=gate-
_truncate_wave`=. Geratur de (<#salientia-iungit-contra-et>), insolida

View file

@ -39,7 +39,7 @@ populifer adeunt quicquam cum **ales** Ixion angulus placet reddere.
## Tractaque serpens arva quoque
{:.center}
![[markdown.md]]
#[dragon :center](dragon.txt)
Inprudens dum memor alma, casses dedi Sinuessa iam quid adicit
`gate_truncate_wave`. [Geratur de](#salientia-iungit-contra-et), insolida

View file

@ -31,136 +31,21 @@
>> Tractaque serpens arva quoque
_ _ _ _ _ _ ___ __
| |_ / | | || |___ __ _ __| (_)_ _ __ _ ( _ )__\ \
| ' \| | | __ / -_) _` / _` | | ' \/ _` | / _ \___| |
|_||_|_| |_||_\___\__,_\__,_|_|_||_\__, | \___/ | |
|___/ /_/
>> h2 Heading
>>> h3 Heading
_ _ _ _ _ _ _
| |__ | || | | | | | ___ __ _ __| (_)_ __ __ _
| '_ \| || |_ | |_| |/ _ \/ _` |/ _` | | '_ \ / _` |
| | | |__ _| | _ | __/ (_| | (_| | | | | | (_| |
|_| |_| |_| |_| |_|\___|\__,_|\__,_|_|_| |_|\__, |
|___/
_ ____ _ _ _ _
| |__ | ___| | | | | ___ __ _ __| (_)_ __ __ _
| '_ \|___ \ | |_| |/ _ \/ _` |/ _` | | '_ \ / _` |
| | | |___) | | _ | __/ (_| | (_| | | | | | (_| |
|_| |_|____/ |_| |_|\___|\__,_|\__,_|_|_| |_|\__, |
|___/
_ __ _ _ _ _
| |__ / /_ | | | | ___ __ _ __| (_)_ __ __ _
| '_ \| '_ \ | |_| |/ _ \/ _` |/ _` | | '_ \ / _` |
| | | | (_) | | _ | __/ (_| | (_| | | | | | (_| |
|_| |_|\___/ |_| |_|\___|\__,_|\__,_|_|_| |_|\__, |
|___/
>> Horizontal Rules
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
>> Emphasis
`!This is bold text`! `!This is bold text`! `*This is italic text`* `*T-
his is italic text`* ~~Strikethrough~~
>> Blockquotes
>>>>Blockquotes can also be nested...
>>>>>>>>by using additional greater-than signs right next to each oth-
>>>>>>>>er...
>>>>>>>>>>>>or with spaces between arrows.
>> Lists
>>> Unordered
+ Create a list by starting a line with `=+`=, `=-`=, or `=*`=
- Marker character change forces new list start:
* Ac tristique libero volutpat at
+ Facilisis in pretium nisl aliquet
- Nulla volutpat aliquam velit
+ Very easy
>>> Ordered
1. Lorem ipsum dolor sit amet
2. Consectetur adipiscing elit
3. Integer molestie lorem at massa
>> Code
Inline `=code`=
Indented code
`=
// Some comments
line 1 of code
line 2 of code
line 3 of code
`=
Block code "fences"
`=
Sample text here...
`=
Syntax highlighting
`=
var foo = function (bar) {
return bar++;
};
console.log(foo(5));
`=
>> Links
`[link text`http://dev.nodeca.com]
`[link with title`http://nodeca.github.io/pica/demo/ "title text!"]
>> Images
`[Minion`https://octodex.github.com/images/minion.png] `[Stormtroopocat-
`https://octodex.github.com/images/stormtroopocat.jpg "The Stormtroopoc-
at"]
<>=======()
(/\___ /|\\ ()==========<>_
\_/ | \\ //|\ ______/ \)
\_| \\ // | \_/
\|\/|\_ // /\/
(oo)\ \_// /
//_/\_\/ / |
@@/ |=\ \ |
\_=\_ \ |
\==\ \|\_ snd
__(\===\( )\
(((~) __(_/ |
(((~) \ /
______/ /
'------'
Inprudens dum memor alma, casses dedi Sinuessa iam quid adicit `=gate_t-
runcate_wave`=. `[Geratur de`#salientia-iungit-contra-et], insolida tem-
ptat `=open`= carentia; genitorem solet, potens. Adit vos ramos mundi c-

View file

@ -50,12 +50,22 @@ class AmaRenderer(TextRenderer):
def _render_heading(self, payload: HeadingPayload, style: BlockStyle) -> None:
self._ensure_header_spacing()
figlet = self._render_figlet_heading(payload.level, payload.text, style)
def render_fn(target_style: BlockStyle) -> List[str]:
figlet = self._render_figlet_heading(payload.level, payload.text, target_style)
if figlet and all(len(line.rstrip()) <= self.width for line in figlet):
self._emit_block(figlet, stylable=False)
return
return [*figlet, ""]
heading = self._process_inline(payload.text)
self._emit_block([f"%h {heading}", ""], stylable=False)
wrapped = self._wrap_text(
heading,
style=target_style,
initial_indent="%h ",
subsequent_indent="%h ",
)
if not wrapped or wrapped[-1] != "":
wrapped.append("")
return wrapped
self._emit_block(render_fn(style), stylable=True, render_fn=render_fn, style=style)
def _render_code_block(self, payload: CodeBlockPayload, style: BlockStyle) -> None:
margin_left, _, _ = self._margins(style)

View file

@ -42,14 +42,24 @@ class MicronRenderer(TextRenderer):
def _render_heading(self, payload: HeadingPayload, style: BlockStyle) -> None:
self._ensure_header_spacing()
figlet = self._render_figlet_heading(payload.level, payload.text, style)
def render_fn(target_style: BlockStyle) -> List[str]:
figlet = self._render_figlet_heading(payload.level, payload.text, target_style)
if figlet and all(len(line.rstrip()) <= self.width for line in figlet):
self._emit_block(figlet, stylable=False)
return
return [*figlet, ""]
level = max(1, min(3, payload.level))
marker = ">" * level
line = f"{marker} {self._process_inline(payload.text)}".rstrip()
self._emit_block([line, ""], stylable=False)
heading = f"{marker} {self._process_inline(payload.text)}".rstrip()
wrapped = self._wrap_text(
heading,
style=target_style,
initial_indent="",
subsequent_indent="",
)
if not wrapped or wrapped[-1] != "":
wrapped.append("")
return wrapped
self._emit_block(render_fn(style), stylable=True, render_fn=render_fn, style=style)
def _render_code_block(self, payload: CodeBlockPayload, style: BlockStyle) -> None:
margin_left, _, _ = self._margins(style)