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

@ -1,12 +1,13 @@
___ _ _ _ _ ___ _ _ _ _
/ __| __ _| (_)___ _ _| |_(_)__ _ / __| __ _| (_)___ _ _| |_(_)__ _
\__ \/ _` | | / -_) ' \ _| / _` | \__ \/ _` | | / -_) ' \ _| / _` |
|___/\__,_|_|_\___|_||_\__|_\__,_| |___/\__,_|_|_\___|_||_\__|_\__,_|
%h Structa hinc vetitus factum
%h Structa hinc vetitus factum
Lorem markdownum omnes tellus, in, Herculeis `=reciprocalPower`= neque Lorem markdownum omnes tellus, in, Herculeis `=reciprocalPower`= neque
@ -15,7 +16,7 @@
%h Fuit video longique dedisse %h Fuit video longique dedisse
Ille stupet, ultra %!INCUNABULA AGENDUM URBES%t mirer %!APER%t, metu. Ille stupet, ultra %!INCUNABULA AGENDUM URBES%t mirer %!APER%t, metu.
@ -34,154 +35,24 @@
%h Tractaque serpens arva quoque %h Tractaque serpens arva quoque
_ _ _ _ _ _ ___ __ <>=======()
| |_ / | | || |___ __ _ __| (_)_ _ __ _ ( _ )__\ \ (/\___ /|\\ ()==========<>_
| ' \| | | __ / -_) _` / _` | | ' \/ _` | / _ \___| | \_/ | \\ //|\ ______/ \)
|_||_|_| |_||_\___\__,_\__,_|_|_||_\__, | \___/ | | \_| \\ // | \_/
|___/ /_/ \|\/|\_ // /\/
(oo)\ \_// /
//_/\_\/ / |
%h h2 Heading @@/ |=\ \ |
\_=\_ \ |
\==\ \|\_ snd
%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">)
Inprudens dum memor alma, casses dedi Sinuessa iam quid adicit `=gate- Inprudens dum memor alma, casses dedi Sinuessa iam quid adicit `=gate-
_truncate_wave`=. Geratur de (<#salientia-iungit-contra-et>), insolida _truncate_wave`=. Geratur de (<#salientia-iungit-contra-et>), insolida
@ -195,7 +66,7 @@
%h Quantaque augent %h Quantaque augent
Acuti ignotis ignis, ostendit nostras terras nondum, petit utque utero Acuti ignotis ignis, ostendit nostras terras nondum, petit utque utero
@ -228,7 +99,7 @@
`= `=
%h Mille parva %h Mille parva
%!MINETUR ET%t aurum! Charaxi sanguine quo; vires subnectite %!PIGNOR- %!MINETUR ET%t aurum! Charaxi sanguine quo; vires subnectite %!PIGNOR-

View file

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

View file

@ -1,19 +1,19 @@
___ _ _ _ _ ___ _ _ _ _
/ __| __ _| (_)___ _ _| |_(_)__ _ / __| __ _| (_)___ _ _| |_(_)__ _
\__ \/ _` | | / -_) ' \ _| / _` | \__ \/ _` | | / -_) ' \ _| / _` |
|___/\__,_|_|_\___|_||_\__|_\__,_| |___/\__,_|_|_\___|_||_\__|_\__,_|
>> Structa hinc vetitus factum >> Structa hinc vetitus factum
Lorem markdownum omnes tellus, in, Herculeis `=reciprocalPower`= neque Lorem markdownum omnes tellus, in, Herculeis `=reciprocalPower`= neque
promissa est Latiae caput umero talia fidissima, nymphae. Foedera et sa- promissa est Latiae caput umero talia fidissima, nymphae. Foedera et sa-
gittas tenetur adde matri esse: talia manibus. gittas tenetur adde matri esse: talia manibus.
>> Fuit video longique dedisse >> Fuit video longique dedisse
Ille stupet, ultra `!incunabula agendum urbes`! mirer `!aper`!, metu. A- Ille stupet, ultra `!incunabula agendum urbes`! mirer `!aper`!, metu. A-
egides novissima sunt turis quatiebant umbrosaque `[putares`#mille-parv- egides novissima sunt turis quatiebant umbrosaque `[putares`#mille-parv-
@ -29,138 +29,23 @@
Ixion angulus placet reddere. Ixion angulus placet reddere.
>> Tractaque serpens arva quoque >> 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- Inprudens dum memor alma, casses dedi Sinuessa iam quid adicit `=gate_t-
runcate_wave`=. `[Geratur de`#salientia-iungit-contra-et], insolida tem- runcate_wave`=. `[Geratur de`#salientia-iungit-contra-et], insolida tem-
ptat `=open`= carentia; genitorem solet, potens. Adit vos ramos mundi c- ptat `=open`= carentia; genitorem solet, potens. Adit vos ramos mundi c-
@ -171,7 +56,7 @@
el et at `=printerWildcardParallel`= inquit positosque comites ultra. el et at `=printerWildcardParallel`= inquit positosque comites ultra.
>> Quantaque augent >> Quantaque augent
Acuti ignotis ignis, ostendit nostras terras nondum, `[petit utque uter- Acuti ignotis ignis, ostendit nostras terras nondum, `[petit utque uter-
o`#structa-hinc-vetitus-factum] sepulcrales, pluma reseratis Ismario. T- o`#structa-hinc-vetitus-factum] sepulcrales, pluma reseratis Ismario. T-
@ -199,7 +84,7 @@
`= `=
>>> Mille parva >>> Mille parva
`!Minetur et`! aurum! Charaxi sanguine quo; vires subnectite `!pigno- `!Minetur et`! aurum! Charaxi sanguine quo; vires subnectite `!pigno-
ra`!, omnique hostibus loquerentur aquae Solis ferox? `!Cum ne`!, putat ra`!, omnique hostibus loquerentur aquae Solis ferox? `!Cum ne`!, putat

View file

@ -7,10 +7,10 @@
|___/ /_/ |___/ /_/
%h h2 Heading %h h2 Heading
%h h3 Heading %h h3 Heading
_ _ _ _ _ _ _ _ _ _ _ _ _ _
@ -37,7 +37,7 @@
|___/ |___/
%h Horizontal Rules %h Horizontal Rules
-------------------------------------------------------------------------- --------------------------------------------------------------------------
@ -47,7 +47,7 @@
-------------------------------------------------------------------------- --------------------------------------------------------------------------
%h Emphasis %h Emphasis
%!THIS IS BOLD TEXT%t %bTHIS IS BOLD TEXT%t %!This is italic text%t %bThis %!THIS IS BOLD TEXT%t %bTHIS IS BOLD TEXT%t %!This is italic text%t %bThis
@ -55,7 +55,7 @@
%h Blockquotes %h Blockquotes
Blockquotes can also be nested... Blockquotes can also be nested...
@ -63,10 +63,10 @@
or with spaces between arrows. or with spaces between arrows.
%h Lists %h Lists
%h Unordered %h Unordered
+ Create a list by starting a line with `=+`=, `=-`=, or `=*`= + Create a list by starting a line with `=+`=, `=-`=, or `=*`=
@ -77,7 +77,7 @@
+ Very easy + Very easy
%h Ordered %h Ordered
1. Lorem ipsum dolor sit amet 1. Lorem ipsum dolor sit amet
@ -85,7 +85,7 @@
3. Integer molestie lorem at massa 3. Integer molestie lorem at massa
%h Code %h Code
Inline `=code`= Inline `=code`=
@ -125,7 +125,7 @@
`= `=
%h Links %h Links
link text (<http://dev.nodeca.com>) link text (<http://dev.nodeca.com>)
@ -136,7 +136,7 @@
%h Images %h Images
Minion (<https://octodex.github.com/images/minion.png>) Stormtroopocat Minion (<https://octodex.github.com/images/minion.png>) Stormtroopocat

View file

@ -7,10 +7,10 @@
|___/ /_/ |___/ /_/
>> h2 Heading >> h2 Heading
>>> h3 Heading >>> h3 Heading
_ _ _ _ _ _ _ _ _ _ _ _ _ _
@ -37,20 +37,20 @@
|___/ |___/
>> Horizontal Rules >> Horizontal Rules
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
>> Emphasis >> Emphasis
`!This is bold text`! `!This is bold text`! `*This is italic text`* `*This `!This is bold text`! `!This is bold text`! `*This is italic text`* `*This
is italic text`* ~~Strikethrough~~ is italic text`* ~~Strikethrough~~
>> Blockquotes >> Blockquotes
>>>>Blockquotes can also be nested... >>>>Blockquotes can also be nested...
@ -59,10 +59,10 @@
>>>>>>>>>>>>or with spaces between arrows. >>>>>>>>>>>>or with spaces between arrows.
>> Lists >> Lists
>>> Unordered >>> Unordered
+ Create a list by starting a line with `=+`=, `=-`=, or `=*`= + Create a list by starting a line with `=+`=, `=-`=, or `=*`=
- Marker character change forces new list start: - Marker character change forces new list start:
@ -72,14 +72,14 @@
+ Very easy + Very easy
>>> Ordered >>> Ordered
1. Lorem ipsum dolor sit amet 1. Lorem ipsum dolor sit amet
2. Consectetur adipiscing elit 2. Consectetur adipiscing elit
3. Integer molestie lorem at massa 3. Integer molestie lorem at massa
>> Code >> Code
Inline `=code`= Inline `=code`=
@ -113,7 +113,7 @@
`= `=
>> Links >> Links
`[link text`http://dev.nodeca.com] `[link text`http://dev.nodeca.com]
@ -121,7 +121,7 @@
`[link with title`http://nodeca.github.io/pica/demo/ "title text!"] `[link with title`http://nodeca.github.io/pica/demo/ "title text!"]
>> Images >> Images
`[Minion`https://octodex.github.com/images/minion.png] `[Minion`https://octodex.github.com/images/minion.png]
`[Stormtroopocat`https://octodex.github.com/images/stormtroopocat.jpg "The `[Stormtroopocat`https://octodex.github.com/images/stormtroopocat.jpg "The

View file

@ -50,12 +50,22 @@ class AmaRenderer(TextRenderer):
def _render_heading(self, payload: HeadingPayload, style: BlockStyle) -> None: def _render_heading(self, payload: HeadingPayload, style: BlockStyle) -> None:
self._ensure_header_spacing() self._ensure_header_spacing()
figlet = self._render_figlet_heading(payload.level, payload.text, style) def render_fn(target_style: BlockStyle) -> List[str]:
if figlet and all(len(line.rstrip()) <= self.width for line in figlet): figlet = self._render_figlet_heading(payload.level, payload.text, target_style)
self._emit_block(figlet, stylable=False) if figlet and all(len(line.rstrip()) <= self.width for line in figlet):
return return [*figlet, ""]
heading = self._process_inline(payload.text) 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: def _render_code_block(self, payload: CodeBlockPayload, style: BlockStyle) -> None:
margin_left, _, _ = self._margins(style) margin_left, _, _ = self._margins(style)

View file

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