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

Create alternative syntax for frontmatter #2145

Merged
merged 9 commits into from
Apr 1, 2023

Conversation

EltonGohJH
Copy link
Contributor

@EltonGohJH EltonGohJH commented Feb 7, 2023

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • Feature addition or enhancement
  • Code maintenance
  • DevOps
  • Improve developer experience
  • Others, please explain:

Overview of changes:
Resolves #1851

Anything you'd like to highlight/discuss:
As dicussed previously, I have added regex to check in between the new frontmatter index. Can someone do a sanity check that my markdown-it plugin is correct. If all is good, I will go create new test cases and add new docs.

I tested this with CS2103T website with 700 over pages and it took around the same time of 2mins 6 seconds. So, this test on my end concluded that performance is not visibly affected at all.

Proposed commit message: (wrap lines at 72 characters)

Add support for YAML-style frontmatter syntax

Currently, MarkBind only supports frontmatter tags. This commit adds
support for YAML-style frontmatter syntax, which can help to ease
migration and familiarization with MarkBind.

Let's,
* create a markdown-it plugin to support the YAML-style frontmatter
  syntax
* add new test cases to ensure that the feature works as intended
* update the related documentation

Most static site generators use YAML-style frontmatter syntax. Adding
support for this syntax in MarkBind will make it more accessible to
users who are already familiar with this syntax.

This change resolves the following issue:
* #1851: Alternative syntax for frontmatter

Checklist: ☑️

  • Updated the documentation for feature additions and enhancements
  • Added tests for bug fixes or features
  • Linked all related issues
  • No unrelated changes

Copy link
Contributor

@jovyntls jovyntls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the work @EltonGohJH - nice catching all the edge cases of the markdown parsing!
The --- frontmatter works for me and is a nice feature addition 🎉

@EltonGohJH EltonGohJH force-pushed the elton-alt-frontmatter branch from 812375e to 70c8eed Compare February 25, 2023 03:54
Copy link
Contributor

@jovyntls jovyntls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes @EltonGohJH - just one more nit

@EltonGohJH EltonGohJH force-pushed the elton-alt-frontmatter branch from 40d1ac4 to 80c8f1d Compare March 31, 2023 15:52
@EltonGohJH EltonGohJH changed the title WIP: Create alternative syntax for frontmatter Create alternative syntax for frontmatter Apr 1, 2023
@EltonGohJH
Copy link
Contributor Author

I did some double checking to ensure that the converted html is equivalent to what our current frontmatter.

MB verify 1
MB verify 2

@tlylt
Copy link
Contributor

tlylt commented Apr 1, 2023

LGTM after:

  • adding negative tests
  • convert the plugin to typescript

@EltonGohJH
Copy link
Contributor Author

Negative testcases
file1
file2
file3

Copy link
Contributor

@tlylt tlylt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tlylt tlylt requested a review from jovyntls April 1, 2023 10:47
@EltonGohJH EltonGohJH merged commit aa5702e into MarkBind:master Apr 1, 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.

Alternative syntax for frontmatter
3 participants