Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8395193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:14:21+00:00 2026-06-09T20:14:21+00:00

I have to parse YAML Front Matter in java like jekyll , So Iooked

  • 0

I have to parse YAML Front Matter in java like jekyll, So Iooked into the source code, and found this but I can’t make much sense of it(I don’t know much ruby).

So My Question is, How do I parse YAML Front Matter in java ?

I have snakeyaml in my classpath and I would be parsing YAML Front Matter from a markdown file, for which I use pegdown

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T20:14:23+00:00Added an answer on June 9, 2026 at 8:14 pm
    void parse(Reader r) throws IOException {
        BufferedReader br = new BufferedReader(r);
    
        // detect YAML front matter
        String line = br.readLine();
        while (line.isEmpty()) line = br.readLine();
        if (!line.matches("[-]{3,}")) { // use at least three dashes
            throw new IllegalArgumentException("No YAML Front Matter");
        }
        final String delimiter = line;
    
        // scan YAML front matter
        StringBuilder sb = new StringBuilder();
        line = br.readLine();
        while (!line.equals(delimiter)) {
            sb.append(line);
            sb.append("\n");
            line = br.readLine();
        }
    
        // parse data
        parseYamlFrontMatter(sb.toString());
        parseMarkdownOrWhatever(br);
    }
    

    To get a obtain Reader, you will probably need a FileReader or an InputStreamReader.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using yamlbeans to deserialize yaml files into Java objects. This works fine as
How do I format a YAML document like this so that PyYAML can parse
I have to parse an HTML document into different new files. The problem is
I have to parse this string in C: XFR 3 NS 207.46.106.118:1863 0 207.46.104.20:1863\r\n
I am new to YAML and have been searching for ways to parse a
I would like to know how to parse a YAML file with the following
I have this YAML file: name: Firas dirs: [/bin/, /home/phiras/] I am using YAML::Syck
It's very simple task, but I struggle for hours. I have parse xml from
I have to work a lot with the flexible file format Yaml, i like
I have a string like pe%20to%C5%A3i%20mai. When I apply urllib.parse.unquote to it, I get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.