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

Improve Markdown support #37

Merged
merged 16 commits into from
Nov 27, 2018
Merged

Improve Markdown support #37

merged 16 commits into from
Nov 27, 2018

Conversation

johanjanssens
Copy link
Member

@johanjanssens johanjanssens commented Nov 26, 2018

Template Filters

Inline partial

To render an inline partial using a different format than the page format use the partial tag, format <ktml:partial:[format]>[...]</ktml:partial:[format]>. Example:

<ktml:partial format="md">
Markdown goes here
</ktml:partial> 

Partial rendering is enabled by default and doesn't need to be added to the page filters.

Table of contents

Generate a table of contents (toc) from a page's HTML headers by adding a ktml:toc tag to the page. By default the TOC will use h1 to h6. The min and max headers can be configured using the min and max attributes. <ktml:toc minx="2" max="4"> will only use the headings 2,3,4.

Dynamic anchors are added to the header tags automatically using anchor.js.

Note: Table of contents filter needs to be enabled by adding the tocfilter to the process:filterslist in the page frontmatter.

Code highlighter

To use the code highlighter either use:

  1. The default markdown approach using triple backtics

  2. The advanced way using fenced code blocks. This is a feature of PHP Markdown Extra.

  3. The html way using <pre><ode class="[language]"></code></pre>. The default language is php

The highlighter is using the Atom One Light style

Note: Code highlighting needs to be enabled by adding the highlight filter to the process:filters list in the page frontmatter.

The template filter uses the format <ktml:template:[format]></ktml:template:[format]> and is used to wrap a part of a template to be rendered using the engine matching the specified format.
Implement table of content filter that replaces <ktml:toc> with the table of contents of the pages using the page headings, by default the TOC will use h2 to h6. Behavior can be adapted using the 'base' and 'max' attributes, eg <ktml:toc max="2"> will only use
Add highlight.php to composer and Iimplement Atom One Light style. To use the code highlighter either use backticks in markdown, or use <pre><ode language="[language]"></code></pre>. If no language attribute exists the default language: php will be used.
- Add new anchor() method to the behavior template helper to inject the anchor library.
- Load the anchor behavior if enabled (default is enabled) in the toc filter
@johanjanssens johanjanssens added this to the 0.4.0 milestone Nov 26, 2018
@johanjanssens johanjanssens self-assigned this Nov 26, 2018
Ensure that markdown filtering happens before highlighting
Changed tag syntax to <ktml:partial format="[format]"></ktml:partial>
@johanjanssens johanjanssens merged commit 14c99a1 into master Nov 27, 2018
@johanjanssens johanjanssens deleted the feature/36-markdown branch November 27, 2018 01:18
@johanjanssens johanjanssens mentioned this pull request Jan 8, 2019
@johanjanssens johanjanssens mentioned this pull request Jun 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant