Git Product home page Git Product logo

Comments (3)

larixer avatar larixer commented on July 18, 2024

Hi,

Sounds like it is not the issue with Grain, but rather with IDE, but it is possible to achieve solution with Grain.

You can put headers and content separately. For example:
page_c.md <-- content goes here
page.md <-- header goes here

Then you exclude all _c files from Grain engine processing, e.g. in SiteConfig.groovy add
excludes << /[^_]*_c.(md|html|adoc)/

The relevant documentation section:
http://sysgears.com/grain/docs/latest/#source-processing-configuration

After that in Resource Mapper you add back content part to header-only resources:

resources.collect { Map resource ->
    def contentFile = new File(...) // Build correct _c file path from resource location here
    resource.source = contentFile.text // Set contents of the resource
}

The relevant documentation section:
http://sysgears.com/grain/docs/latest/#resource-representation

from grain.

katoquro avatar katoquro commented on July 18, 2024

Ok, I'll try with my case
page.md <- content
page.yml <- variables

I thought that this feature can be included into core because it is might be difficult to upgrade grain with contains a lot of custom code.

from grain.

larixer avatar larixer commented on July 18, 2024

This is possible as well, in this case:

You exclude all html/md files from Grain engine processing, e.g. in SiteConfig.groovy add
excludes << /.*.(md|html|adoc)/

After that in Resource Mapper you add back content part to header-only resources AND you need to set the markup type:

resources.collect { Map resource ->
    def contentFile = new File(...) // Build correct file path from resource location here
    resource.source = contentFile.text // Set contents of the resource
    resource.markup = 'html' // Set markup type, e.g. html, md or adoc
}

from grain.

Related Issues (19)

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.