diff --git a/examples/nuxt-tailwind/.editorconfig b/examples/nuxt-tailwind/.editorconfig new file mode 100644 index 0000000..5d12634 --- /dev/null +++ b/examples/nuxt-tailwind/.editorconfig @@ -0,0 +1,13 @@ +# editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/examples/nuxt-tailwind/.gitignore b/examples/nuxt-tailwind/.gitignore new file mode 100644 index 0000000..e8f682b --- /dev/null +++ b/examples/nuxt-tailwind/.gitignore @@ -0,0 +1,90 @@ +# Created by .ignore support plugin (hsz.mobi) +### Node template +# Logs +/logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# next.js build output +.next + +# nuxt.js build output +.nuxt + +# Nuxt generate +dist + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless + +# IDE / Editor +.idea + +# Service worker +sw.* + +# macOS +.DS_Store + +# Vim swap files +*.swp diff --git a/examples/nuxt-tailwind/README.md b/examples/nuxt-tailwind/README.md new file mode 100644 index 0000000..a37ed2a --- /dev/null +++ b/examples/nuxt-tailwind/README.md @@ -0,0 +1,69 @@ +# nuxt + +## Build Setup + +```bash +# install dependencies +$ yarn install + +# serve with hot reload at localhost:3000 +$ yarn dev + +# build for production and launch server +$ yarn build +$ yarn start + +# generate static project +$ yarn generate +``` + +For detailed explanation on how things work, check out the [documentation](https://nuxtjs.org). + +## Special Directories + +You can create the following extra directories, some of which have special behaviors. Only `pages` is required; you can delete them if you don't want to use their functionality. + +### `assets` + +The assets directory contains your uncompiled assets such as Stylus or Sass files, images, or fonts. + +More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/assets). + +### `components` + +The components directory contains your Vue.js components. Components make up the different parts of your page and can be reused and imported into your pages, layouts and even other components. + +More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/components). + +### `layouts` + +Layouts are a great help when you want to change the look and feel of your Nuxt app, whether you want to include a sidebar or have distinct layouts for mobile and desktop. + +More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/layouts). + + +### `pages` + +This directory contains your application views and routes. Nuxt will read all the `*.vue` files inside this directory and setup Vue Router automatically. + +More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/get-started/routing). + +### `plugins` + +The plugins directory contains JavaScript plugins that you want to run before instantiating the root Vue.js Application. This is the place to add Vue plugins and to inject functions or constants. Every time you need to use `Vue.use()`, you should create a file in `plugins/` and add its path to plugins in `nuxt.config.js`. + +More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/plugins). + +### `static` + +This directory contains your static files. Each file inside this directory is mapped to `/`. + +Example: `/static/robots.txt` is mapped as `/robots.txt`. + +More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/static). + +### `store` + +This directory contains your Vuex store files. Creating a file in this directory automatically activates Vuex. + +More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/store). diff --git a/examples/nuxt-tailwind/buildMarkdown.js b/examples/nuxt-tailwind/buildMarkdown.js new file mode 100644 index 0000000..ab66f6b --- /dev/null +++ b/examples/nuxt-tailwind/buildMarkdown.js @@ -0,0 +1,36 @@ +const fs = require('fs'); +const path = require('path'); +const { processMarkdown } = require('epic-remark'); + +const postsDirectory = path.join(__dirname, 'posts'); +const outputDirectory = path.join(__dirname, 'static'); + +const processPosts = async () => { + const fileNames = fs.readdirSync(postsDirectory); + const posts = []; + + for (const fileName of fileNames) { + const filePath = path.join(postsDirectory, fileName); + const fileContents = fs.readFileSync(filePath, 'utf8'); + const options = { + addHeadingIds: true, + addTableOfContents: true, + calculateReadingTime: true, + readingTimeOptions: { + wordsPerMinute: 200, + round: true, + }, + renderEmbeds: true, + } + const processedContent = await processMarkdown(fileContents, options); + posts.push(processedContent); + } + + if (!fs.existsSync(outputDirectory)){ + fs.mkdirSync(outputDirectory); + } + + fs.writeFileSync(path.join(outputDirectory, 'posts.json'), JSON.stringify(posts)); +}; + +processPosts(); diff --git a/examples/nuxt-tailwind/components/NuxtLogo.vue b/examples/nuxt-tailwind/components/NuxtLogo.vue new file mode 100644 index 0000000..970eba0 --- /dev/null +++ b/examples/nuxt-tailwind/components/NuxtLogo.vue @@ -0,0 +1,11 @@ + + + diff --git a/examples/nuxt-tailwind/components/Tutorial.vue b/examples/nuxt-tailwind/components/Tutorial.vue new file mode 100644 index 0000000..6b96cf0 --- /dev/null +++ b/examples/nuxt-tailwind/components/Tutorial.vue @@ -0,0 +1,52 @@ + + + + diff --git a/examples/nuxt-tailwind/helpers/getAllPosts.js b/examples/nuxt-tailwind/helpers/getAllPosts.js new file mode 100644 index 0000000..befabea --- /dev/null +++ b/examples/nuxt-tailwind/helpers/getAllPosts.js @@ -0,0 +1,16 @@ +import fs from 'fs'; +import path from 'path'; + +const postsDirectory = path.join(process.cwd(), 'posts'); + +export function getAllPosts() { + const fileNames = fs.readdirSync(postsDirectory); + + return fileNames.map(fileName => { + const id = fileName.replace(/\.md$/, ''); + const fullPath = path.join(postsDirectory, fileName); + const fileContents = fs.readFileSync(fullPath, 'utf8'); + + return { id, fileContents }; + }); +} diff --git a/examples/nuxt-tailwind/nuxt.config.js b/examples/nuxt-tailwind/nuxt.config.js new file mode 100644 index 0000000..725de86 --- /dev/null +++ b/examples/nuxt-tailwind/nuxt.config.js @@ -0,0 +1,54 @@ +export default { + // Target: https://go.nuxtjs.dev/config-target + target: 'static', + + // Global page headers: https://go.nuxtjs.dev/config-head + head: { + title: 'nuxt', + htmlAttrs: { + lang: 'en' + }, + meta: [ + { charset: 'utf-8' }, + { name: 'viewport', content: 'width=device-width, initial-scale=1' }, + { hid: 'description', name: 'description', content: '' }, + { name: 'format-detection', content: 'telephone=no' } + ], + link: [ + { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' } + ] + }, + + // Global CSS: https://go.nuxtjs.dev/config-css + css: [ + ], + + // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins + plugins: [ + '~/plugins/loadPosts.js', + ], + + // Auto import components: https://go.nuxtjs.dev/config-components + components: true, + + // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules + buildModules: [ + // https://go.nuxtjs.dev/tailwindcss + '@nuxtjs/tailwindcss', + ], + + // Modules: https://go.nuxtjs.dev/config-modules + modules: [ + ], + + // Build Configuration: https://go.nuxtjs.dev/config-build + build: { + }, + hooks: { + build: { + before() { + require('./buildMarkdown'); + } + } + } +} diff --git a/examples/nuxt-tailwind/package.json b/examples/nuxt-tailwind/package.json new file mode 100644 index 0000000..9b66838 --- /dev/null +++ b/examples/nuxt-tailwind/package.json @@ -0,0 +1,23 @@ +{ + "name": "nuxt-tailwind", + "version": "1.0.0", + "private": true, + "scripts": { + "dev": "nuxt", + "build": "nuxt build", + "start": "nuxt start", + "generate": "nuxt generate" + }, + "dependencies": { + "core-js": "^3.25.3", + "epic-remark": "^0.1.7", + "nuxt": "^2.15.8", + "vue": "^2.7.10", + "vue-server-renderer": "^2.7.10", + "vue-template-compiler": "^2.7.10" + }, + "devDependencies": { + "@nuxtjs/tailwindcss": "^5.3.3", + "postcss": "^8.4.17" + } +} diff --git a/examples/nuxt-tailwind/pages/_slug.vue b/examples/nuxt-tailwind/pages/_slug.vue new file mode 100644 index 0000000..518e1a5 --- /dev/null +++ b/examples/nuxt-tailwind/pages/_slug.vue @@ -0,0 +1,18 @@ + + + diff --git a/examples/nuxt-tailwind/pages/index.vue b/examples/nuxt-tailwind/pages/index.vue new file mode 100644 index 0000000..5bc355a --- /dev/null +++ b/examples/nuxt-tailwind/pages/index.vue @@ -0,0 +1,18 @@ + + + diff --git a/examples/nuxt-tailwind/plugins/loadPosts.js b/examples/nuxt-tailwind/plugins/loadPosts.js new file mode 100644 index 0000000..e725280 --- /dev/null +++ b/examples/nuxt-tailwind/plugins/loadPosts.js @@ -0,0 +1,4 @@ +export default async (context, inject) => { + const posts = await require('@/static/posts.json'); + inject('posts', posts); +}; diff --git a/examples/nuxt-tailwind/posts/exmaple.md b/examples/nuxt-tailwind/posts/exmaple.md new file mode 100644 index 0000000..821546c --- /dev/null +++ b/examples/nuxt-tailwind/posts/exmaple.md @@ -0,0 +1,73 @@ +--- +title: "Welcome to the Example Post" +date: "2023-12-15" +author: "Your Name" +summary: "Explore the rich capabilities of Markdown through this illustrative guide." +tags: ["Markdown", "Formatting", "Tutorial"] +--- + +# Welcome to the Marvels of Markdown! + +Hello there! I'm excited to take you on a journey through the wonderful world of Markdown. This versatile language allows you to create richly formatted documents with ease. Whether you're a writer, developer, or just someone who loves streamlined content creation, Markdown has something for everyone! + +## The Art of Styling Text + +Let's start with the basics - styling text. Markdown provides simple yet powerful tools to bring your words to life: + +- **Bold**: To emphasize a point, wrap your text in `**` or `__`. For example, **bold text** makes your words stand out. +- _Italic_: Want a subtle emphasis? Italicize your text with `*` or `_`. It's perfect for _italic text_. +- `Monospace`: When you need to highlight code or technical terms, use backticks for `monospace formatting`. + +## Organizing Ideas with Lists + +Lists are a great way to organize information. Markdown supports both unordered (bullet points) and ordered (numbered) lists. + +### Unordered List + +- First Point: Great for summarizing ideas. +- Second Point: + - Detail A: Even supports nested points. + - Detail B: For more complex structures. + +### Ordered List + +1. Step One: Clearly mark the sequence of tasks. +2. Step Two: + 1. Subtask One: Break down into smaller steps. + 2. Subtask Two: Ensures clarity and precision. + +## Connecting Through Links and Images + +Markdown also simplifies linking to other resources and embedding images: + +- Raw Link: Visit https://example.com directly. +- [Formatted Link](https://example.com): Embed links within text for a cleaner look. +- ![Sample Image](./example.png) +- Insert images easily to make your post visually appealing. + +## Structuring Data with Tables + +Presenting data? Use tables for clarity: + +| Feature | Supported | +|-----------|-----------| +| Headings | Yes | +| Lists | Yes | +| Images | Yes | +| Tables | Yes | + +## Rich Embedded Content + +Markdown supports embedding content like GitHub gists and YouTube videos directly in your post: + +### Embed a GitHub Gist + +!embed https://gist.github.com/sandypockets/f37072055678da1eab8643567600717b + +### Embed a YouTube Video + +!embed https://www.youtube.com/watch?v=zRpsRKuyi3Y + +--- + +Markdown is an incredibly flexible and user-friendly language, perfect for creating content that's both beautiful and functional. I hope this guide has inspired you to explore the full range of possibilities with Markdown. Happy writing! diff --git a/examples/nuxt-tailwind/static/example.png b/examples/nuxt-tailwind/static/example.png new file mode 100644 index 0000000..4f7cd3b Binary files /dev/null and b/examples/nuxt-tailwind/static/example.png differ diff --git a/examples/nuxt-tailwind/static/favicon.ico b/examples/nuxt-tailwind/static/favicon.ico new file mode 100644 index 0000000..d751f60 Binary files /dev/null and b/examples/nuxt-tailwind/static/favicon.ico differ diff --git a/examples/nuxt-tailwind/static/posts.json b/examples/nuxt-tailwind/static/posts.json new file mode 100644 index 0000000..d54ff2a --- /dev/null +++ b/examples/nuxt-tailwind/static/posts.json @@ -0,0 +1 @@ +[{"frontMatter":{"title":"Welcome to the Example Post","date":"2023-12-15","author":"Your Name","summary":"Explore the rich capabilities of Markdown through this illustrative guide.","tags":["Markdown","Formatting","Tutorial"]},"contentHtml":"

Welcome to the Marvels of Markdown!

\n

Hello there! I'm excited to take you on a journey through the wonderful world of Markdown. This versatile language allows you to create richly formatted documents with ease. Whether you're a writer, developer, or just someone who loves streamlined content creation, Markdown has something for everyone!

\n

The Art of Styling Text

\n

Let's start with the basics - styling text. Markdown provides simple yet powerful tools to bring your words to life:

\n\n

Organizing Ideas with Lists

\n

Lists are a great way to organize information. Markdown supports both unordered (bullet points) and ordered (numbered) lists.

\n

Unordered List

\n\n

Ordered List

\n
    \n
  1. Step One: Clearly mark the sequence of tasks.
  2. \n
  3. Step Two:
  4. \n
  5. Subtask One: Break down into smaller steps.
  6. \n
  7. Subtask Two: Ensures clarity and precision.
  8. \n
\n\n

Markdown also simplifies linking to other resources and embedding images:

\n\n

Structuring Data with Tables

\n

Presenting data? Use tables for clarity:

\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
FeatureSupported
HeadingsYes
ListsYes
ImagesYes
TablesYes
\n

Rich Embedded Content

\n

Markdown supports embedding content like GitHub gists and YouTube videos directly in your post:

\n

Embed a GitHub Gist

\n
\n

Embed a YouTube Video

\n\n
\n

Markdown is an incredibly flexible and user-friendly language, perfect for creating content that's both beautiful and functional. I hope this guide has inspired you to explore the full range of possibilities with Markdown. Happy writing!

","toc":"","readingTime":2}] \ No newline at end of file diff --git a/examples/nuxt-tailwind/store/README.md b/examples/nuxt-tailwind/store/README.md new file mode 100644 index 0000000..1972d27 --- /dev/null +++ b/examples/nuxt-tailwind/store/README.md @@ -0,0 +1,10 @@ +# STORE + +**This directory is not required, you can delete it if you don't want to use it.** + +This directory contains your Vuex Store files. +Vuex Store option is implemented in the Nuxt.js framework. + +Creating a file in this directory automatically activates the option in the framework. + +More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/vuex-store).