Block Directives

#62

For comparison (using http://talk.commonmark.org/t/generic-directives-plugins-syntax as reference )

::::::::::::::::::::::::: comment ::::::::::::::::::::::::::::::::::
This text is completely ignored by kramdown - a comment in the text.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Do you see ::comment[ this text ]?
::comment[ some other comment ]

::options{ key="val" }

Using my concept:

!comment::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
This text is completely ignored by kramdown - a comment in the text.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Do you see !comment[ this text ]?
!comment[ some other comment ]

!options{ key="val" }
0 Likes

#63

: can be changed to another symbol.

Example from kramdown does not allow content indentation, liked by some writers. And i’m not sure that it’s possible to make markup good for blocks and inlines in the same time. That’s why this topic was created separately.

0 Likes

#64

:: should be changed since it is commonly used as namespace marker and that might or might not clash. @ had been considered and discarded since it used in @user and such.

{: and {:: are almost safe. and probably also !name[...]{} might be easy to parse.

0 Likes

#65

Here an example

sphinx

.. py:function:: send_message(sender, recipient, message_body, [priority=1])

   Send a message to a recipient

   :param str sender: The person sending the message
   :param str recipient: The recipient of the message
   :param str message_body: The body of the message
   :param priority: The priority of the message, can be a number 1-5
   :type priority: integer or None
   :return: the message id
   :rtype: int
   :raises ValueError: if the message_body exceeds 160 characters
   :raises TypeError: if the message_body is not a basestring

using the !name notation

!py:function[send_message(sender, recipient, message_body, [priority=1])]::
    Send a message to recipient
::
{param=str name=sender desc="The person sending the message"}
{param=str ....

This does not look that nice and would require the implementation to not collapse the key-value attribute attached to nodes but keep a a key-list_of_values.

Probably if I want to keep my sanity while I’m trying to support this sphinx feature might be just better do something like

!sphinx::
.. py:function:: send_message(sender, recipient, message_body, [priority=1])

   Send a message to a recipient

   :param str sender: The person sending the message
   :param str recipient: The recipient of the message
   :param str message_body: The body of the message
   :param priority: The priority of the message, can be a number 1-5
   :type priority: integer or None
   :return: the message id
   :rtype: int
   :raises ValueError: if the message_body exceeds 160 characters
   :raises TypeError: if the message_body is not a basestring
::  

or use {::sphinx} and {:/} using the kramdown syntax.

I’m looking into sphinx + markdown since it would be something the rust people are also evaluating the mix.

0 Likes

#66

using the indent-block syntax it would have the neat feature of degrade nicely on parsers not supporting it:

:: extension

    this is a part of the extension

    this as well

    :: options might be freeform strings
    :: or be=otherwise key=value 

Would render as

:: extension

this is a part of the extension

this as well

:: options might be freeform strings
:: or be=otherwise key=value

it would reuse the same logic used by the code and would be mainly compatible with rst.

:: py:function[send_message(sender, recipient, message_body, [priority=1])]

    Send a message to a recipient

    :: param str sender: The person sending the message
    :: param str recipient: The recipient of the message
    :: param str message_body: The body of the message
    :: param priority: The priority of the message, can be a number 1-5
    :: type priority: integer or None
    :: return: the message id
    :: rtype: int
    :: raises ValueError: if the message_body exceeds 160 characters
    :: raises TypeError: if the message_body is not a basestring
0 Likes

#67

That’s all was discussed in spoiler thread. Indented markup is nice, but hard to use without appropriate editor (to quote blocks, for example).

There are people, who like it, and who dislike it. That’s personal and can’t be changed. I think, good spec should cover both styles, with single universal, or with 2 separate markups.

PS. may be fenced containers are not the best, but those allows to use both styles.

0 Likes

#68

I’m more concerned about how attributes are used in rst and to make sure to match sphinx I won’t have to do something terrible.

having a rst-compatible support for block and span directives would be a huge plus for me.

0 Likes

#69

Just noticed that @vitaly 's https://markdown-it.github.io/ demo contains custom containers. Glad to see that it it works well at the very least as a container format. Degrades rather gracefully as well. Great work!

Would be interesting to see how people find containers, and if it causes any problem. Also if it’s possible to use it as a container for latex maths or something like that.


:::: warning ::::
*here be dragons*
:::::::::::::::::

Degrades to :::: warning :::: here be dragons ::::::::::::::::: in common-mark strict mode. Else it uses warning as the classname to wrap around the *here be dragon* content.

0 Likes

Fenced Block Types, Generic Extension/Webcomponents, and fallback handling
#70

It is not rst compatible and readthedocs does need something like the one I suggested to win more users to the markdown flavour.

0 Likes