Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add classes to content blocks #5

Open
woerndl opened this issue Mar 5, 2017 · 2 comments
Open

Add classes to content blocks #5

woerndl opened this issue Mar 5, 2017 · 2 comments

Comments

@woerndl
Copy link

woerndl commented Mar 5, 2017

Is there a way to add a (css) class to a content block? Especially for images. E.g. to create left/right floating images in the document?

@onebigclownshoe
Copy link
Collaborator

It isn't possible to add classes to images in standard Markdown.

The simplest workaround is to wrap the content block in a <div> and pass the class there. Any styles can then be handled by the CSS in your template.

screen shot 2017-03-06 at 19 39 10

@woerndl
Copy link
Author

woerndl commented Mar 6, 2017

Thanks.

Maybe interesting for the future though. There is a already a discussion about image alignment in the CommonMark forum, even mentions Writer explicitly: https://talk.commonmark.org/t/floating-images/266/29

Of course it's a question of where the line between content and presentation should be drawn. But if you use Writer to write (and export) e.g. a thesis or book (which is now possible since templates, images, blocks and variables are added) you'll probably run into this if you don't want only fullwidth single column images images in the same style. It could also play well with the WordPress and Medium export.

We use the syntax ![altText](image.png "title"){.floatLeft} in a custom Kirby installations and editors come along with it. Even though the image syntax itself sucks.

The potential value for the feature came with the template support and now with content blocks it could make even more sense. It would even be possible to import the same content block and style it in two different ways. E.g. with /mytext.txt {.highlight} or whatever the syntax you'd choose would look like.

So maybe a feature worth considering, even though it isn't part of standard markdown (just as content blocks aren't).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants