Coder Social home page Coder Social logo

Markdown ToC about hyde HOT 4 CLOSED

hyde avatar hyde commented on June 6, 2024
Markdown ToC

from hyde.

Comments (4)

atiw003 avatar atiw003 commented on June 6, 2024

Anyone, just need to know something is on the road map otherwise I can modify source on my side.

from hyde.

navilan avatar navilan commented on June 6, 2024

Hi,

It works fine for me.

You can test it with the basic template.

  1. Create a new site with the basic template

    hyde -s ~/test create
    
  2. Edit site.yaml and add this at the root level (this is the part you are missing I think)

markdown:
    extensions:
        - toc
  1. Edit about.html and add this below the meta data:

    [TOC]
    
    # Header 1
    
    ## Header 2
    
    ## Header 22
    
    

Now if you generate the site, you should see the TOC generated nicely.

from hyde.

atiw003 avatar atiw003 commented on June 6, 2024

Thanks a lot and sorry for troubling on this small issue which finally worked out .
cheers

from hyde.

dandersson avatar dandersson commented on June 6, 2024

I found this issue post when searching for information regarding similar troubles with getting the [TOC] construct to work. If anyone else finds this same thread, I can mention that my problems had to do with that the default Hyde setting of the Jinja2 templating engine sets trim_blocks = True.

From the Jinja2 documentation:

trim_blocks

If this is set to True the first newline after a block is removed (block, not variable tag!). Defaults to False.

Because of this, the following does not work:

{% mark excerpt -%}

Dummy excerpt.

{%- endmark %}

[TOC]

After the whitespace gobbling by trim_blocks, [TOC] will be interpreted as being a continuation of the Dummy excerpt paragraph and will not be rendered as a special command.

However, this works:

{% mark excerpt -%}

Dummy excerpt.

{%- endmark %}


[TOC]

It is thus easily worked around, but it was not immediately apparent where the problem lay.

from hyde.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.