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

Feature outline #121

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Feature outline #121

wants to merge 7 commits into from

Conversation

aleray
Copy link

@aleray aleray commented Jun 24, 2012

Hi, I have ported the python-markdown outline extension. Here is what it does:

Wraps the document logical sections (as implied by h1-h6 headings).

By default, the wrapper element is a section tag having a class attribute "sectionN", where N is the header level being wrapped.

More information here:

https://github.com/aleray/mdx_outline

It can be used by enabling the MKDEXT_INS option like this
(example/sundown.c):

    markdown = sd_markdown_new(MKDEXT_INS, 16, &callbacks, &options)

then, after compilation the following command line:

    echo "++ins++" | ./sundown

results in:

    <p><ins>ins</ins></p>
This is a rewrite of the outline extension for Python-Markdown
(http://git.constantvzw.org/?p=aa.mdx_outline.git;a=tree).

Wraps the document logical sections (as implied by h1-h6 headings) in
html5 <section> tags.

Big thank you to Pierre Marchand for helping me with this, and taking
time showing me the basics of C99!
One can enable it that way:

    sdhtml_renderer(&callbacks, &options, HTML_OUTLINE);
section tags were not closed if current header level was lower than
previous header level (eg. h1 following an h2).
If the HTML_OUTLINE flag is enabled, documents like:

    # level 1
    ## level 2

turn into:

    <section class="section1">
        <h1>level 1</h1>
        <section class="section2">
            <h2>level2</h2>
        </section>
    </section>
dokutoku pushed a commit to dokutoku/sundown that referenced this pull request Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant