facelessuser / PyMdown

CLI batch markdown converter/previewer. Wrapped around Python's Markdown Package and Pygments.
MIT License
5 stars 9 forks source link

Have a single extension to overwrite current bold and italic #5

Closed facelessuser closed 10 years ago

facelessuser commented 10 years ago

Moving forward, I want to overwrite the current bold and italic via an extension. Current behavior has a number of things I want to address:

  1. ** test ** should not be valid. Tokens should not have a space directly after opening and directly before closing.
  2. ***test* test*** triple tokens are not a special token unto themselves, but are actually tokens for em nested in strong, and as such, if one of the tokens are terminating like is occurring above, it should not be recognized as a strong, em.
  3. Triple tokens, if the single and double are smart, should act like a smart variant such that things like ***test********test*** should be (<strong><em>test********test</em></strong>). So should double and smart by themselves: **test********test** and *test********test* => <strong>test********test</strong> and <em>test********test</em>.
  4. ***test*test*** when smart rules is off, should be handled by case 5 below.
  5. ***test* test** should be <strong><em>test</em> test</strong> while ***test** test* should be <em><strong>test</strong> test</em>. For sane results, this form will not allow the this *****test** => <strong><em>*</em>test</strong> and will differ to normal strong and em <em>*</em><strong>test</strong> (output if smart rules are disabled).
  6. For the sake of keeping the extension simple, there will be a restriction for all or nothing smart rules. So if * is smart, so should ** and same for _ and __. It would greatly reduce the complexity of the rules. It will make it easy to handle smart boundaries etc. There is no reason why you couldn't enable smart completely for _ and not on * and be get all the complexity you should need. If you are really going crazy with nesting, at that point maybe directly using strong and em tags is what is needed. So in short, when smart is enabled for * this would work text ***test*** text this would not text***test***text. But you if _ where dumb, you could do text_**test**_text and get what you need.
facelessuser commented 10 years ago

Closed.