bouncepaw / mycomarkup

Markup language for Mycorrhiza Wiki. Moved to SourceHut
https://mycorrhiza.wiki/help/en/mycomarkup
Apache License 2.0
5 stars 2 forks source link

HTML class name modifier #3

Closed handlerug closed 2 years ago

handlerug commented 3 years ago

How am I supposed to style my wiki now?!

ghost commented 3 years ago

@handlerug Use custom JS scripts, XSS is very bad, anyone can break wiki.

handlerug commented 3 years ago

Are you telling me I should use JS to write markup? What's next, some JS framework like React for the frontend? /s

handlerug commented 3 years ago

But really, this wiki thing should better have some way of conditionally inserting custom HTML/CSS bits onto pages. I'm using a bit of JavaScript to style certain pages on my wiki in bulk, but because it's JS I can see the layout flash, and it makes me twitch. Why so much hatred against custom templates? Shouldn't the wiki be a medium for the information where you can present it freely rather than a locked-down textarea?

ghost commented 3 years ago

@handlerug Are you want to use custom HMTL on any hyphae? If yes, mycorrhiza is bad for this.

handlerug commented 3 years ago

@handlerug Are you want to use custom HMTL on any hyphae? If yes, mycorrhiza is bad for this.

Do you mean it's bad for this because you don't want this to happen or because no one has stepped up to do the work?

ghost commented 3 years ago

@handlerug First. If you want to create your own site with own html, you should use static site generator. No one must be able to inject unsafe raw html on public wikis.

DanInSpace104 commented 3 years ago

@GuAlSe But mycorrhiza is not only about public wikis And, there is user roles, so you can restrict injections

ghost commented 3 years ago

@DanInSpace104 Anyway, how to do it? Anyone can edit any hyphae (if we don't talk about wikis with auth but without registration)

bouncepaw commented 3 years ago

Oh yeah, my favourite topic.

@handlerug: But really, this wiki thing should better have some way of conditionally inserting custom HTML/CSS bits onto pages.

This is never going to happen in Mycomarkup. Injecting them with JS is what you can do, and this is what you do, actually.

@handlerug: Shouldn't the wiki be a medium for the information where you can present it freely rather than a locked-down textarea?

Well, not freely, as you can see.

@handlerug: Why so much hatred against custom templates?

This is not related to Mycomarkup HTML injection.

@GuAlSe: If you want to create your own site with own html, you should use static site generator.

God help people who use static site generators.

@DanInSpace104: And, there is user roles, so you can restrict injections

Cannot restrict them, Mycomarkup grammar cannot change depending on the user.


Indeed, Mycorrhiza is not about public wikis only. It should be quite safe to use HTML on private wikis. But I strongly despise the idea of making Mycomarkup a superset of HTML.

This issue is an example of the XY problem. On Pescenomicon, @handlerug's wiki, HTML tricks are used for these two things:

I agree that these things are nice to have, I would love to see them too. The real issue is having a way to do these things in Mycomarkup. We need blocks for that, not barely-working unsafe HTML injections.

Something like that:

img right {
  hot fish photo
}
columns {
  column {
    ## Volume 1
    🐟
  }
  column {
    ## Volume 2
    🐠
  }
  column {
    ## Volume 3
    🐡
  }
}
handlerug commented 3 years ago

Cannot restrict them, Mycomarkup grammar cannot change depending on the user.

But you can restrict page editing to admins only.

I agree that these things are nice to have, I would love to see them too. The real issue is having a way to do these things in Mycomarkup. We need blocks for that, not barely-working unsafe HTML injections.

You see, there's a big problem with that: you're never going to have all the tags for every possible layout, without either making another CSS utility framework or blowing up the complexity of the markup and the amount of tags. You listed only my two current uses, but I have a ton more in my head. And JavaScript is not a solution at all: what about people who disable JS by default using uMatrix, for example? Then pages will look broken. And rewriting HTML using JS requires ugly hacks like inserting hidden <h6>s, too.

That's why I have love-hate kind of a relationship with Mycorrhiza. Sometimes I just want to drop all raws and translations from my wiki just because it's so much simpler to make a simple shell script that'll generate what I want, not what this thing wants. That JavaScript layout hack is a hack. If that's the way everyone is supposed to make the wiki work as they want it to work, then I'm out.

handlerug commented 3 years ago

Injecting them with JS is what you can do, and this is what you do, actually.

What I do is finding bugs in your code and doing ugly stuff like this:

=> # </a></li></ul><div>my html here</div>

Which also makes the markup invalid, by the way, but none of the major browsers care.

bouncepaw commented 3 years ago

@handlerug: You see, there's a big problem with that: you're never going to have all the tags for every possible layout

Yeah, indeed. I see no problem with that. There is a set of layouts that will be enough. This set is what will Mycomarkup eventually become. I can think of collapsible blocks (spoilers), different image gallery layouts, sidenotes, comments. There is probably more.

@handlerug: You listed only my two current uses, but I have a ton more in my head.

Tell me.

@handlerug: about people who disable JS by default using uMatrix, for example?

They will be sad.

@handlerug: And rewriting HTML using JS requires ugly hacks like inserting hidden

s, too.

Perhaps we need a special thing for ugly hacks 🤔

@handlerug: That's why I have love-hate kind of a relationship with Mycorrhiza.

Same here, for different reasons.

@handlerug: That JavaScript layout hack is a hack. If that's the way everyone is supposed to make the wiki work as they want it to work, then I'm out.

Well, you are actually meant to submit to the Mycorrhizal ways. It will be sad if you are out, to be honest. There aren't many wikis out there.

handlerug commented 3 years ago

Yeah, indeed. I see no problem with that. There is a set of layouts that will be enough. This set is what will Mycomarkup eventually become. I can think of collapsible blocks (spoilers), different image gallery layouts, sidenotes, comments. There is probably more.

@handlerug: You listed only my two current uses, but I have a ton more in my head.

Tell me.

For example, grid containers with automatically padded images for chapters like on my old website (which requires a fair amount of CSS and HTML classes), cute responsive character grids (CSS grids), text alignment, different text styles (good for the home page?), inline images (nice shrooms & eggs), clearfixes and custom float wrapping, flexboxes. Just something off the top of my head.

I don't want to make Mycomarkup have some way of injecting custom HTML—that's just not going to fly, HTML is not the only output format, it's insecure, and it's a horrible hack, I know. I want to arrive at a conclusion everyone agrees with that'll fit nicely into the markup and still allow some degree of freedom.

For example,

Perhaps we need a special thing for ugly hacks 🤔

My proposal is to have an ugly hack that would modify the element to have a custom ID or a class name. Because styling <h6>s is not fun at all; first you have to hide it, and specifically the one you want (you don't want to hide all of them, do you?), and then you have to select the next element. The markup looks really messy too, scaring newcomers, semantics advocates, and @bouncepaw. Using such a hack I could, for example, make some text have a custom style without Mycomarkup reinventing <font>, or make a certain image ignore height limitations while keeping the limitation for other images.

The most important thing—NO JAVASCRIPT FOR PRESENTATIONAL PURPOSES. PLEASE. It's a curse of the modern web.

A checkbox that says 'Enable JavaScript', toggled on

I want to be able to turn this off without breaking my own wiki, please.

This wiki engine (seemingly) advocates for the small web, yet you force JS upon administrators for something as trivial as adding some class names. Even though I think you will never be able to adequately implement everything my JS script does in Mycomarkup to successfully remove it, trivial stuff shouldn't require it, IMO.

bouncepaw commented 3 years ago

grid containers with automatically padded images for chapters like on my old website (which requires a fair amount of CSS and HTML classes), cute responsive character grids (CSS grids), text alignment, different text styles (good for the home page?), inline images (nice shrooms & eggs), clearfixes and custom float wrapping, flexboxes. Just something off the top of my head.

Cute.

This wiki engine (seemingly) advocates for the small web, yet you force JS upon administrators for something as trivial as adding some class names.

It actually discourages you from doing so by making JS the only option. Well, it doesn't stop you.

I want to arrive at a conclusion everyone agrees with that'll fit nicely into the markup and still allow some degree of freedom.

So, what do you want? Those blocks you mentioned above and a way to add CSS classes?

handlerug commented 3 years ago

That would be a good start, yes. I could've contributed them myself but I don't know how to write parsers, sadly. You can ignore them in output formats other than HTML, so nothing will be lost. Specific tags such as img right and other would be nice, too, but columns will probably also need a screen size specifier (sm, md, lg, xl...) to rearrange the columns only starting from this minimum screen size.

bouncepaw commented 2 years ago

Mufufu