markdown-it / markdown-it-container

Fenced container plugin for markdown-it markdown parser
MIT License
496 stars 74 forks source link

Hints at how to fork for inline and custom labels needed. #14

Closed cougarten closed 7 years ago

cougarten commented 7 years ago

Hi, I'm trying to make pretty sidenotes. To get by with just CSS I need something like the following behaviour (I just invented some markup):

My text has [pretty *sidenotes*](^pretty_sidenote) inline.

[^pretty_sidenote]: 
  # I am a big sidenote

parsing to:

<p>
  My text has <span class="sidenote_text">pretty <b>sidenotes</b><div class="sidenote">
    <h1>I am a big sidenote</h1>
  </div> inline.
</p>

Now my troubles:

I'm actually close to attempting to hack together some [insert_sidenote_open_tag] and search+replace it with html and than do the sidenote via js :/ Or use the bigfoot.js and try to adapt it to permanently visible sidenotes.

Here some dirty working sidenotes I made (with some other markdown parser): http://malea.lacerta.uberspace.de/quickup/testi/

They don't support markdown though and they have to be written inline...

Thanks for the help and the library itself!

puzrin commented 7 years ago

First, i don't recommend to reinvent custom markup :) . Second, if you still need it, and wish to have markup inside sidenotes, i'd recommend to avoid inline notation.

Something like https://github.com/markdown-it/markdown-it-container should work well.

Other plugins to investigate can be:

I would use markdown-it-container approach to keep things simple.