Giter Site home page Giter Site logo

grav-plugin-markdown-notices's Introduction

Grav Markdown Notices Plugin

The markdown-notices plugin for Grav allows generation of notice blocks of text via markdown:

Installation

This plugin is easy to install with GPM.

$ bin/gpm install markdown-notices

Configuration

Simply copy the user/plugins/markdown-notices/markdown-notices.yaml into user/config/plugins/markdown-notices.yaml and make your modifications.

enabled: true
built_in_css: true
base_classes: 'notices'
level_classes: [yellow, red, blue, green]

Examples

Using one level of !

! Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris feugiat quam erat, ut iaculis diam posuere nec.
! Vestibulum eu condimentum urna. Vestibulum feugiat odio ut sodales porta. Donec sit amet ante mi. Donec lobortis
! orci dolor. Donec tristique volutpat ultricies. Nullam tempus, enim sit amet fringilla facilisis, ipsum ex
! tincidunt ipsum, vel placerat sem sem vitae risus. Aenean posuere sed purus nec pretium.

You will output the following HTML

<div class="notices yellow">
    <p>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris feugiat quam erat, ut iaculis diam posuere nec.
        Vestibulum eu condimentum urna. Vestibulum feugiat odio ut sodales porta. Donec sit amet ante mi. Donec lobortis
        orci dolor. Donec tristique volutpat ultricies. Nullam tempus, enim sit amet fringilla facilisis, ipsum ex
        tincidunt ipsum, vel placerat sem sem vitae risus. Aenean posuere sed purus nec pretium.
    </p>
</div>

The notices class determined by the base_classes and yellow class is determined by the level_classes in the configuration. You can customize this as you need.

!! Lorem ipsum dolor sit amet, **consectetur adipiscing** elit. Mauris feugiat quam erat, ut iaculis diam posuere nec.
!!
!! * List item a
!! * List item b
!!
!! orci dolor. Donec tristique volutpat ultricies. Nullam tempus, enim sit amet fringilla facilisis, ipsum ex
!! tincidunt ipsum, vel placerat sem sem vitae risus. Aenean posuere sed purus nec pretium.

Two levels of !! will use the second level class etc. You can also use complex markdown inside the notices.

grav-plugin-markdown-notices's People

Contributors

aleskl avatar flaviocopes avatar lufog avatar mahagr avatar miguelsalespereira avatar n-parsons avatar olevik avatar rhukster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

grav-plugin-markdown-notices's Issues

base_classes feature not working

The new "base_classes" feature does not work in latest release 1.0.2, obviously, since latest merged pull request "Allow adding inline notices, to use inside tables #10" was wrongly written against release 1.0.1 and not against mainline, overwriting the previous one "Ability to specify own base classes #9", thus deleting the entire feature implementation.

Please, revert #10 and rewrite the patch (or ask original submitter @miguelsalespereira) and push a new release.

Thank you

Can't add notices to a table

I have tried to add notices to a table cell and it seems that the plugin still can't do this. Are there any plans to add this functionality?

Plugin separating lines in separate divs

Hi, thanks for the plugin, it's really great!
Here's my problem: every return to the line is output in a separate div in the resulting HTML. This isn't the behavior explained in the documentation for the plugin (it says it should end up in a single bloc).
I'm having a hard time explaining so here's an example taking exactly the example given in the read me file of the plugin:
image
According to the documentation it should output this html:
image
But instead this is what I get:
image
and the page looks messed up:
image

I'm using a (barely modified) version of antimatter, but I don't think it should cause any issue. Let me know if I'm not using the plugin properly. It looks almost right so I'd like to be able to use it.
thanks a lot

How to add more colors?

I tried to add a new css class in grav\user\plugins\markdown-notices\assets\notices.css and a new entry in grav\user\config\plugins\markdown-notices.yaml - but the new color won't get rendered. Do I need to do something more/else or is it just not posssible?

Exclamation points with a space before at the end of a phrase trigger Markdown-Notice

I've come into a but involving that Markdown-Notice was showing itself in some random pages of my project. The markdown causing the bug to occur was like this one :

Nous avons le plaisir de vous accueillir sur notre tout nouveau site, désormais plus rapide, avec plus de fonctionnalités ! Plus d'infos [ici](/actualites/nouveau-site).

Making the link to be partially converted, and wrapped into a markdown notice :

2019-09-09_23h37m40s_firefox

After a few debugging, I suspected and confirmed Markdown-Notice's fault.

But this is just by pure intuition about the use of ! at the begining of blocks to use the plugin, that I said to myself that it could be any exclamation point in a phrase that would trigger the plugin, if preceeded by a space.

So I tried to remove the space, like in american standards :

Nous avons le plaisir de vous accueillir sur notre tout nouveau site, désormais plus rapide, avec plus de fonctionnalités! Plus d'infos [ici](/actualites/nouveau-site).

and the bug disappeard !

Conclusion

It seems that the plugin does not restrict itself to searching for "!" in the begining of lines, wich causes any "!" to be captured if a space separates it from the rest of the string.

My intuition says me that is is a problem of RegEx...

where am I supposed to put the notices.css when creating a custom theme?

I'm trying to add custom colors to the notices and I'm able to add a new color theme with the markdown-notices.yaml in the user/configs/plugins/ folder

but where am I supposed to add the copy of notices.css?

I tried to put it in the same folder as the markdown-notices.yaml and also created an assets directory in the same folder and tried to put it there, but it is still using the CSS from user/plugins/markdown-notices/assets/notices.css and not from the config folder

there is an option to disable the Use built-in CSS and I can place the css file in the themes scss folder to make it work, but is this the recommended way to do it?

[Feature request] Dark theme support

Would be nice to have dark theme support out of the box. Currently I believe you have to write your own styles, because notices are too bright as they are now

CSS corrections

Thank you for the useful plugin that generates really nice code!

However, the style-sheet was not rendering notices correctly - paddings were off, especially top padding. Below is the corrected assets/notices.css to generate notices that are more similar to the original looks achieved by nested blockquotes. Border settings were moved to the .notices class, margin for paragraph is set to 0 and only border-color is left in the color classes:

.notices {
padding: 15px;
margin: 1rem 0;
border-width: 1px 1px 1px 10px;
border-style: solid;
border-radius: 3px;
}

.notices p {
margin: 0;
}

.notices.yellow {
border-color: #f0ad4e;
background: #fcf8f2;
color: #df8a13;
}

.notices.red {
border-color: #d9534f;
background: #fdf7f7;
color: #b52b27;
}

.notices.blue {
border-color: #5bc0de;
background: #f4f8fa;
color: #28a1c5;
}

.notices.green {
border-color: #5cb85c;
background: #f1f9f1;
color: #3d8b3d;
}

Markdown notices flattens nestsed lists

Markdown notices is flattening my nested lists and I'm not sure why.

The snippet of markdown code below

1.  **Posture**
     1.  **Make yourself as comfortable as possible with your back straight.** Do this whether you sit on a chair or a cushion on the floor. 
     2.  **Get your back, neck, and head in alignment, front-to-back and side-to-side.**
2.  **Relax**
     1.  **While maintaining a straight back, release any tension in the body.**
     2.  **Relax your mind.** 

with Markdown notices renders as

1.  **Posture**
2.  **Make yourself as comfortable as possible with your back straight.** Do this whether you sit on a chair or a cushion on the floor. 
3.  **Get your back, neck, and head in alignment, front-to-back and side-to-side.**
4.  **Relax**
5.  **While maintaining a straight back, release any tension in the body.**
6.  **Relax your mind.** 

whereas without markdown notices, it renders as

1.  **Posture**
     a.  **Make yourself as comfortable as possible with your back straight.** Do this whether you sit on a chair or a cushion on the floor. 
     b.  **Get your back, neck, and head in alignment, front-to-back and side-to-side.**
2.  **Relax**
     a.  **While maintaining a straight back, release any tension in the body.**
     b.  **Relax your mind.** 

Is there anyway to get the nested lists to work properly?

Thanks,

Sean

Not working in table cells

Hello!

Try to use inside tables:

| 1 | 2 | 3 |
| - | - | - |
| **4** | **5** | ! **6** |
| **7** | **8** | **9** |
| **10** | **11** | **12** |
| **13** | !! **14** | **15** |

Result:
image

Block quote syntax (>>>) has been deprecated

Hi,

I have just noticed (:-D) that >>> notices has been deprecated... but the new plugin does not offer the same Tip,Note,etc structures.

Do you plan to add it?

PD: Grav is great!

Regards,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.