From 85d2a5f9288e6ec510900e3a3e0478158285394c Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Thu, 12 Sep 2024 10:35:33 -0700 Subject: [PATCH] Improves Tailwind detection performance and reliability --- docs/components/markdown/markdown.mdx | 2 ++ .../document.1.jpg | Bin .../document.pdf | Bin 46826 -> 46826 bytes .../document.1.jpg | Bin .../document.pdf | Bin 30339 -> 30339 bytes .../document.1.jpg | Bin .../document.pdf | Bin 39538 -> 39538 bytes .../document.1.jpg | Bin .../document.2.jpg | Bin .../document.pdf | Bin 86075 -> 86075 bytes docs/sortedDocs.json | 2 +- docs/ui/templates.mdx | 8 +++---- docs/ui/templates/invoice-advanced.mdx | 2 +- docs/ui/templates/invoice.mdx | 2 +- docs/ui/templates/receipt.mdx | 2 +- docs/ui/templates/scientific-report.mdx | 2 +- src/tailwind/tailwind.tsx | 22 ++++++++++++++---- tests/compile.test.tsx | 18 ++++++++++++++ 18 files changed, 47 insertions(+), 13 deletions(-) rename docs/images/previews/{ui-templates-invoice-advanced-089aa4f4 => ui-templates-invoice-advanced-657df4ea}/document.1.jpg (100%) rename docs/images/previews/{ui-templates-invoice-advanced-089aa4f4 => ui-templates-invoice-advanced-657df4ea}/document.pdf (99%) rename docs/images/previews/{ui-templates-invoice-808342e7 => ui-templates-invoice-c1137a92}/document.1.jpg (100%) rename docs/images/previews/{ui-templates-invoice-808342e7 => ui-templates-invoice-c1137a92}/document.pdf (99%) rename docs/images/previews/{ui-templates-receipt-4906d507 => ui-templates-receipt-644d535a}/document.1.jpg (100%) rename docs/images/previews/{ui-templates-receipt-4906d507 => ui-templates-receipt-644d535a}/document.pdf (99%) rename docs/images/previews/{ui-templates-scientific-report-31829950 => ui-templates-scientific-report-7f68dcf5}/document.1.jpg (100%) rename docs/images/previews/{ui-templates-scientific-report-31829950 => ui-templates-scientific-report-7f68dcf5}/document.2.jpg (100%) rename docs/images/previews/{ui-templates-scientific-report-31829950 => ui-templates-scientific-report-7f68dcf5}/document.pdf (99%) diff --git a/docs/components/markdown/markdown.mdx b/docs/components/markdown/markdown.mdx index e8e9884..0464b92 100644 --- a/docs/components/markdown/markdown.mdx +++ b/docs/components/markdown/markdown.mdx @@ -110,6 +110,8 @@ body { You can use the `tocRenderer` prop to render a table of contents from your Markdown content. The headers will be automatically detected and rendered in the order they appear. You need to place the `` component in your Markdown content to render the table of contents. +You can also use the `id` attribute in your headers to link to them directly. +
diff --git a/docs/images/previews/ui-templates-invoice-advanced-089aa4f4/document.1.jpg b/docs/images/previews/ui-templates-invoice-advanced-657df4ea/document.1.jpg similarity index 100% rename from docs/images/previews/ui-templates-invoice-advanced-089aa4f4/document.1.jpg rename to docs/images/previews/ui-templates-invoice-advanced-657df4ea/document.1.jpg diff --git a/docs/images/previews/ui-templates-invoice-advanced-089aa4f4/document.pdf b/docs/images/previews/ui-templates-invoice-advanced-657df4ea/document.pdf similarity index 99% rename from docs/images/previews/ui-templates-invoice-advanced-089aa4f4/document.pdf rename to docs/images/previews/ui-templates-invoice-advanced-657df4ea/document.pdf index 21e76457b8f3d06155b3905bc3adc0ae79250459..4ede63487c7a4b8f2aedecfa5e8c5d7638bf1326 100644 GIT binary patch delta 153 zcmaF$mg&`7rVUrNIy*ZXSQxq(x|kZc8JoB`nmM_c8@o9>TRJ+rS{OT97~3h>5K=N( Nd|N41%sIbJ8UQuuDV6{L delta 153 zcmaF$mg&`7rVUrNI-8msJ6Sq8I=Q(Rnwyw7Svp!6J3E;=nHjlSSelv|n%gPZ5K=N( Nd|N41%sIbJ8UPAlDBb`7 diff --git a/docs/images/previews/ui-templates-invoice-808342e7/document.1.jpg b/docs/images/previews/ui-templates-invoice-c1137a92/document.1.jpg similarity index 100% rename from docs/images/previews/ui-templates-invoice-808342e7/document.1.jpg rename to docs/images/previews/ui-templates-invoice-c1137a92/document.1.jpg diff --git a/docs/images/previews/ui-templates-invoice-808342e7/document.pdf b/docs/images/previews/ui-templates-invoice-c1137a92/document.pdf similarity index 99% rename from docs/images/previews/ui-templates-invoice-808342e7/document.pdf rename to docs/images/previews/ui-templates-invoice-c1137a92/document.pdf index 84a7188fca503b668b2e2d6b7ffdb7c7ce29047c..bccb289ba8c2ed7898681f60e0a92d41eb12586d 100644 GIT binary patch delta 176 zcmZpE%h>#uaYKHovzxiGi<6wbxrv*ZrKOXjlZl0;iLsH1ld+MbshxriAtjSH nl@`YlQbdF~cCmJLT*W1cMI{wQscBrs28N~#uaYKHov!l6@k&CODrK6dtg^7`?g`=~Xxv8_8lckHLv5}*Txt)RyAtjSH nl@`YlQbdF~cCmJLT*W1cMI{wQscBrs28N~hHz{0Ox2ft^fc4 delta 176 zcmeygh3V54rVVj3on0->oZKv399;|z%}h+3O)Z?=T#YP^9nIZb3{1@pEbSC*2q~Go oaAt8FAw@)(V;5^@$5mXCSX5F`l$yq6Y-wz2&ZVmA>hHz{0HRJU;s5{u diff --git a/docs/images/previews/ui-templates-scientific-report-31829950/document.1.jpg b/docs/images/previews/ui-templates-scientific-report-7f68dcf5/document.1.jpg similarity index 100% rename from docs/images/previews/ui-templates-scientific-report-31829950/document.1.jpg rename to docs/images/previews/ui-templates-scientific-report-7f68dcf5/document.1.jpg diff --git a/docs/images/previews/ui-templates-scientific-report-31829950/document.2.jpg b/docs/images/previews/ui-templates-scientific-report-7f68dcf5/document.2.jpg similarity index 100% rename from docs/images/previews/ui-templates-scientific-report-31829950/document.2.jpg rename to docs/images/previews/ui-templates-scientific-report-7f68dcf5/document.2.jpg diff --git a/docs/images/previews/ui-templates-scientific-report-31829950/document.pdf b/docs/images/previews/ui-templates-scientific-report-7f68dcf5/document.pdf similarity index 99% rename from docs/images/previews/ui-templates-scientific-report-31829950/document.pdf rename to docs/images/previews/ui-templates-scientific-report-7f68dcf5/document.pdf index 2cccda8bae4c76a8b419b331e6b8f7baf3dffbc1..5fcebf17630d6830adaef4b184a39150ce089d7d 100644 GIT binary patch delta 157 zcmdnJfOYo*)`l&Ns{YPymZpvdMn+B+h6a`
Client-side
Server-side
\n\n#### Preview\n\nA simple function to compile a React component to an HTML string with the Onedoc print styles.\n ```jsx\n const html = await compile();\n ```\n\n\n\n
\n\n```jsx\nimport { compile } from \"@fileforge/react-print\";\n\n\n
Hello World!
\n
;\n\n```\n
\n\n```css\n@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap\");\n\nhtml,\nbody {\n font-size: 28px;\n font-family: \"Inter\", sans-serif;\n}\n\n@page {\n size: A4;\n}\n\n```\n\n
\n\n### Examples\n\n#### Emotion CSS\n\nPass `{ emotion: true }` as the second compile option to merge and extract critical CSS using Emotion. Some libraries such as Chakra UI require this option to work correctly.\n\n```jsx\nconst html = await compile(, { emotion: true });\n```\n\n\n\n
\n\n```jsx\nimport { compile } from \"@fileforge/react-print\";\nimport { Button, ChakraProvider, extendTheme } from \"@chakra-ui/react\";\n\n<>\n \n \n \n;\n\n```\n\n\n```css\n@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap\");\n\nhtml,\nbody {\n font-size: 28px;\n font-family: \"Inter\", sans-serif;\n}\n\n@page {\n size: A4;\n}\n\n```\n\n
\n\n","config":{"name":"compile","description":"","components":{"compile":{"server":true,"client":true,"examples":{"default":{"description":"A simple function to compile a React component to an HTML string with the Onedoc print styles.\n ```jsx\n const html = await compile();\n ```","template":{"key":null,"ref":null,"props":{"children":{"type":"div","key":null,"ref":null,"props":{"className":"bg-red-400","children":"Hello World!"},"_owner":null,"_store":{}}},"_owner":null,"_store":{}},"templateString":"(\n \n
Hello World!
\n
\n )"},"emotion":{"description":"Pass `{ emotion: true }` as the second compile option to merge and extract critical CSS using Emotion. Some libraries such as Chakra UI require this option to work correctly.\n\n```jsx\nconst html = await compile(, { emotion: true });\n```","template":{"key":null,"ref":null,"props":{"children":{"key":null,"ref":null,"props":{"children":{"type":{},"key":null,"ref":null,"props":{"colorScheme":"blue","children":"Hello"},"_owner":null,"_store":{}}},"_owner":null,"_store":{}}},"_owner":null,"_store":{}},"name":"Emotion CSS","compileOptions":{"emotion":true},"externalImports":["import { Button, ChakraProvider, extendTheme } from \"@chakra-ui/react\";"],"templateString":"(\n <>\n \n \n \n \n )"}}}}}}]},{"icon":"fa-brands fa-css3-alt","name":"CSS","description":"Allows adding CSS to the document while securely parsing and escaping it.\n\nNB: While you can add regular CSS with the `