feat: inline code, resource links

fixes Text::is_empty() and allows formatted
text in the context section of quotes (so you can link to /ref)

slight changes to the css of the html generator,
this should fix document preview on link hovering
and might improve nesting if you edit the generated
html in weird ways (should be more robust now).
This commit is contained in:
Mark
2026-08-03 17:53:07 +02:00
parent 8492d0b636
commit b53e6e7bb6
5 changed files with 151 additions and 95 deletions

View File

@@ -15,9 +15,9 @@ in most markdown flavors.
as someone using mharkup, you
` can read and write it in your text editor
` can export and `/printable(print) it
` can export and `/printable[print] it
` can easily (re)organize your document
` probably won't apply formatting on accident `/backtick()
` probably won't apply formatting on accident `/backtick[]
# the format
@@ -46,9 +46,9 @@ for example, here are the sections you just read:
each mharkup file starts with a title,
the first line of the file, which doesn't have
any leading hashtags. a file `+(should) also have a small
any leading hashtags. a file `+[should] also have a small
description of what it will contain, and the file's
actual content `+(should) be in subdocuments.
actual content `+[should] be in subdocuments.
for example, here's how this file starts:
[[
@@ -68,19 +68,20 @@ features of mharkup.
in most cases, a section is just
a few lines of text. you've probably
already noticed that linebreaks are usually
ignored `-(or, more accurately, replaced with spaces).
ignored `-[or, more accurately, replaced with spaces].
sections beginning with a hashtag (#) are special.
sections beginning with a hashtag (`![#]) are special.
the first line specifies the type of section you want,
and the other lines are the section's content.
you've already seen this with #!mharkup in the
you've already seen this with `![#!mharkup] in the
first example.
the types of sections you can create like this are:
` #@ quotes
` #! code blocks
` #\ various extensions
` `![#@] quotes
` `![#!] code blocks
` `![#:] resource links
` `![#\] various extensions
### backticks /here
@@ -90,18 +91,18 @@ with a backtick followed by a space to create a list.
here's a list of things the backtick can do:
` create a list
` represent itself ``: ````
` add a `-(note): ``-(note)
` mark something that's `~(wrong): ``~(wrong)
` use monospace for `!(code): ``!(code)
` mark a non-word or name, like `@(mharkup): ``@(mharkup)
` highlight a `_(special) element: ``_(special)
` add emphasis to `+(something): ``+(something)
` highlight something `*(important): ``*(important)
` insert raw `{`text`}: `<`{`text`}>: `2{`<`{`text`}>}}: `2<`2{`<`{`text`}>}}>>: ...
` link `/here(somewhere): ``/here(somewhere)
` represent itself ``: `!{``}
` add a `-[note]: `!{`-[note]}
` mark something that's `~[wrong]: `!{`~[wrong]}
` include some `![code.f()]: `!{`![code.f()]}
` mark a non-word or name, like `@[mharkup]: ``@[mharkup]
` highlight a `_[special] element: `!{`_[special]}
` add emphasis to `+[something]: `!{`+[something]}
` highlight something `*[important]: `!{`*[important]}
` insert raw `{`text`}: `!<`{`text`}>: `2!{`<`{`text`}>}}: `2!<`2{`<`{`text`}>}}>>: ...
` link `/here[somewhere]: ``/here[somewhere]
` use an extension: ``\spec{...} or ``\spec<...>
` combine any of these: `*_+(whoah): ``*_+(whoah)
` combine any of these: `*_+[whoa`~(h)]: ``*_+[whoa``~(h)]
##
@@ -155,21 +156,32 @@ to use the different section types in more detail.
### quotes
#@mark @21st century
#@mark @21st century `/ref[]
i've solved many problems
that noone's ever had.
in this case, the first line
of the section was #@mark @21st century.
of the section was `!{#@mark @21st century `/ref[]}.
### code
### code blocks
#!python
def do_something_productive():
pass
in this case, the first line
of the section was #!python.
of the section was `!{#!python}.
### resource links /ref
#:other_doc
A document you should read.
#https://example.com/hello
Something external.
The first lines of these sections were `!{#:other_doc} and `!{#https://example.com/hello}.
If the section starts with `!{#:}, the link is relative.
### extensions
@@ -198,14 +210,14 @@ or inline: `\texm<a^2> or `2\texm{ \frac{1}{2} }}
i really don't want to think about how many special
characters i can't use while writing my plaintext documents.
i know that writing `<`*(word)> instead of **word** is inconvenient,
i know that writing `{`*(word)} instead of **word** is inconvenient,
but using *, _, and even \ without any escaping may `-[(?)] already be worth it.
Also, * and _ can't be nested, so if you took `+(this **cool** section)
Also, * and _ can't be nested, so if you took `+[this **cool** section]
and copy-pasted it into an already bold section, you would get
`+(**this **cool** section**) which is just... ew.
Meanwhile `{`*(this `*(cool) section)} works just fine
and produces `*(this `*(cool) section).
`+[**this **cool** section**] which is just... ew.
Meanwhile `{`*[this `*(cool) section]} works just fine
and produces `*[this `*(cool) section].
## why does it need to be printable? /printable
@@ -237,7 +249,7 @@ and here's 10 layers of documents in mharkup:
########## whoah, that's a lot
but it's still perfectly readable
but it's still perfectly readable.
## why are there no nested lists? /listnesting