Mk Notes
Available actions

Preview Action

Preview markdown synchronization results without actually syncing using the preview GitHub Action

The preview action shows you what the synchronization result will look like without actually performing the sync. This is useful for verifying the structure before making changes.

Usage

steps:
  - name: Checkout repository
    uses: actions/checkout@v4

  - name: Preview markdown synchronization
    uses: Myastr0/mk-notes/preview
    with:
      input: './docs' # The path to the markdown file or directory to preview
      format: 'plainText' # The format of the preview ("plainText" or "json")
      output: './preview.txt' # Optional: path to save the preview

Inputs

InputDescriptionRequiredDefault
inputThe path to the markdown file or directory to synchronizetrue-
formatThe format of the preview ("plainText" or "json")true-
outputThe path to the output filefalse-

Outputs

OutputDescription
file-pathThe path to the output file (only set when output is specified)

Examples

Preview Before Sync

name: Preview and Sync

on:
  pull_request:
    paths: ['docs/**']

jobs:
  preview-and-sync:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Preview synchronization
        uses: Myastr0/mk-notes/preview
        with:
          input: './docs'
          format: 'plainText'
          output: './preview.txt'

      - name: Upload preview
        uses: actions/upload-artifact@v4
        with:
          name: sync-preview
          path: ./preview.txt

      - name: Sync to Notion
        if: github.event_name == 'push'
        uses: Myastr0/mk-notes/sync
        with:
          input: './docs'
          destination: ${{ secrets.NOTION_DOCS_PAGE_URL }}
          notion-api-key: ${{ secrets.NOTION_API_KEY }}

Generate JSON Preview

name: Generate JSON Preview

on:
  schedule:
    - cron: '0 0 * * 0' # Weekly

jobs:
  generate-preview:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Generate JSON preview
        uses: Myastr0/mk-notes/preview
        with:
          input: './docs'
          format: 'json'
          output: './docs-structure.json'

      - name: Upload JSON preview
        uses: actions/upload-artifact@v4
        with:
          name: docs-structure
          path: ./docs-structure.json

Preview Formats

Plain Text Format

The plainText format provides a human-readable representation of how your content will appear in Notion, showing the structure and hierarchy.

JSON Format

The json format provides a structured representation of your content, useful for:

  • Automated processing
  • Integration with other tools
  • Detailed analysis of content structure

Best Practices

  • Always use preview before syncing to verify the structure
  • Use JSON format for automated workflows
  • Save preview outputs as artifacts for review
  • Combine preview with conditional sync based on branch or event type