From 0ef12f73995405edd3b9e51c19c2c73ed99caccb Mon Sep 17 00:00:00 2001 From: Antigravity Date: Fri, 29 May 2026 16:43:24 +0000 Subject: [PATCH] =?UTF-8?q?fix(mobile):=20render=20notes=20with=20marked?= =?UTF-8?q?=20(proper=20Markdown=E2=86=92HTML)=20+=20design=20CSS=20soign?= =?UTF-8?q?=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Install marked package (UMD, hors-ligne) - buildHtml: parse Markdown server-side avec marked, inject HTML statique - CSS: typographie soignée, blockquotes brandés, code dark, tables propres - Plus de CDN, fonctionne hors-ligne Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- memento-mobile/.expo/README.md | 13 +++++ memento-mobile/.expo/devices.json | 3 ++ memento-mobile/.expo/types/router.d.ts | 14 +++++ memento-mobile/.gitignore | 6 +++ memento-mobile/app/note/[id].tsx | 75 ++++++++++++++++++++------ memento-mobile/lib/config.ts | 2 +- memento-mobile/package-lock.json | 13 +++++ memento-mobile/package.json | 22 ++++---- memento-mobile/tsconfig.json | 12 ++++- 9 files changed, 131 insertions(+), 29 deletions(-) create mode 100644 memento-mobile/.expo/README.md create mode 100644 memento-mobile/.expo/devices.json create mode 100644 memento-mobile/.expo/types/router.d.ts create mode 100644 memento-mobile/.gitignore diff --git a/memento-mobile/.expo/README.md b/memento-mobile/.expo/README.md new file mode 100644 index 0000000..ce8c4b6 --- /dev/null +++ b/memento-mobile/.expo/README.md @@ -0,0 +1,13 @@ +> Why do I have a folder named ".expo" in my project? + +The ".expo" folder is created when an Expo project is started using "expo start" command. + +> What do the files contain? + +- "devices.json": contains information about devices that have recently opened this project. This is used to populate the "Development sessions" list in your development builds. +- "settings.json": contains the server configuration that is used to serve the application manifest. + +> Should I commit the ".expo" folder? + +No, you should not share the ".expo" folder. It does not contain any information that is relevant for other developers working on the project, it is specific to your machine. +Upon project creation, the ".expo" folder is already added to your ".gitignore" file. diff --git a/memento-mobile/.expo/devices.json b/memento-mobile/.expo/devices.json new file mode 100644 index 0000000..5efff6c --- /dev/null +++ b/memento-mobile/.expo/devices.json @@ -0,0 +1,3 @@ +{ + "devices": [] +} diff --git a/memento-mobile/.expo/types/router.d.ts b/memento-mobile/.expo/types/router.d.ts new file mode 100644 index 0000000..882e0ef --- /dev/null +++ b/memento-mobile/.expo/types/router.d.ts @@ -0,0 +1,14 @@ +/* eslint-disable */ +import * as Router from 'expo-router'; + +export * from 'expo-router'; + +declare module 'expo-router' { + export namespace ExpoRouter { + export interface __routes { + hrefInputParams: { pathname: Router.RelativePathString, params?: Router.UnknownInputParams } | { pathname: Router.ExternalPathString, params?: Router.UnknownInputParams } | { pathname: `/_sitemap`; params?: Router.UnknownInputParams; } | { pathname: `${'/(auth)'}/login` | `/login`; params?: Router.UnknownInputParams; } | { pathname: `${'/(tabs)'}/home` | `/home`; params?: Router.UnknownInputParams; } | { pathname: `${'/(tabs)'}/notebooks` | `/notebooks`; params?: Router.UnknownInputParams; } | { pathname: `${'/(tabs)'}/profile` | `/profile`; params?: Router.UnknownInputParams; } | { pathname: `${'/(tabs)'}/search` | `/search`; params?: Router.UnknownInputParams; } | { pathname: `/note/[id]`, params: Router.UnknownInputParams & { id: string | number; } } | { pathname: `/notebook/[id]`, params: Router.UnknownInputParams & { id: string | number; } }; + hrefOutputParams: { pathname: Router.RelativePathString, params?: Router.UnknownOutputParams } | { pathname: Router.ExternalPathString, params?: Router.UnknownOutputParams } | { pathname: `/_sitemap`; params?: Router.UnknownOutputParams; } | { pathname: `${'/(auth)'}/login` | `/login`; params?: Router.UnknownOutputParams; } | { pathname: `${'/(tabs)'}/home` | `/home`; params?: Router.UnknownOutputParams; } | { pathname: `${'/(tabs)'}/notebooks` | `/notebooks`; params?: Router.UnknownOutputParams; } | { pathname: `${'/(tabs)'}/profile` | `/profile`; params?: Router.UnknownOutputParams; } | { pathname: `${'/(tabs)'}/search` | `/search`; params?: Router.UnknownOutputParams; } | { pathname: `/note/[id]`, params: Router.UnknownOutputParams & { id: string; } } | { pathname: `/notebook/[id]`, params: Router.UnknownOutputParams & { id: string; } }; + href: Router.RelativePathString | Router.ExternalPathString | `/_sitemap${`?${string}` | `#${string}` | ''}` | `${'/(auth)'}/login${`?${string}` | `#${string}` | ''}` | `/login${`?${string}` | `#${string}` | ''}` | `${'/(tabs)'}/home${`?${string}` | `#${string}` | ''}` | `/home${`?${string}` | `#${string}` | ''}` | `${'/(tabs)'}/notebooks${`?${string}` | `#${string}` | ''}` | `/notebooks${`?${string}` | `#${string}` | ''}` | `${'/(tabs)'}/profile${`?${string}` | `#${string}` | ''}` | `/profile${`?${string}` | `#${string}` | ''}` | `${'/(tabs)'}/search${`?${string}` | `#${string}` | ''}` | `/search${`?${string}` | `#${string}` | ''}` | { pathname: Router.RelativePathString, params?: Router.UnknownInputParams } | { pathname: Router.ExternalPathString, params?: Router.UnknownInputParams } | { pathname: `/_sitemap`; params?: Router.UnknownInputParams; } | { pathname: `${'/(auth)'}/login` | `/login`; params?: Router.UnknownInputParams; } | { pathname: `${'/(tabs)'}/home` | `/home`; params?: Router.UnknownInputParams; } | { pathname: `${'/(tabs)'}/notebooks` | `/notebooks`; params?: Router.UnknownInputParams; } | { pathname: `${'/(tabs)'}/profile` | `/profile`; params?: Router.UnknownInputParams; } | { pathname: `${'/(tabs)'}/search` | `/search`; params?: Router.UnknownInputParams; } | `/note/${Router.SingleRoutePart}${`?${string}` | `#${string}` | ''}` | `/notebook/${Router.SingleRoutePart}${`?${string}` | `#${string}` | ''}` | { pathname: `/note/[id]`, params: Router.UnknownInputParams & { id: string | number; } } | { pathname: `/notebook/[id]`, params: Router.UnknownInputParams & { id: string | number; } }; + } + } +} diff --git a/memento-mobile/.gitignore b/memento-mobile/.gitignore new file mode 100644 index 0000000..5873d9a --- /dev/null +++ b/memento-mobile/.gitignore @@ -0,0 +1,6 @@ + +# @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb +# The following patterns were generated by expo-cli + +expo-env.d.ts +# @end expo-cli \ No newline at end of file diff --git a/memento-mobile/app/note/[id].tsx b/memento-mobile/app/note/[id].tsx index 4aba79c..9f31563 100644 --- a/memento-mobile/app/note/[id].tsx +++ b/memento-mobile/app/note/[id].tsx @@ -7,6 +7,7 @@ import { SafeAreaView } from 'react-native-safe-area-context' import { useLocalSearchParams, useRouter } from 'expo-router' import { ArrowLeft, Share2 } from 'lucide-react-native' import { WebView } from 'react-native-webview' +import { marked } from 'marked' import { apiFetch } from '@/lib/api' import { ENDPOINTS } from '@/lib/config' import { C } from '../_layout' @@ -20,30 +21,74 @@ interface Note { } function buildHtml(content: string, title: string) { + // marked runs in Node/JS context — parse server-side, inject final HTML + marked.setOptions({ breaks: true, gfm: true }) + const bodyHtml = marked.parse(content) as string + return ` - + -${content} + +
${title || 'Sans titre'}
+
Note Momento
+
${bodyHtml}
+ ` } diff --git a/memento-mobile/lib/config.ts b/memento-mobile/lib/config.ts index 253dc90..13b77ad 100644 --- a/memento-mobile/lib/config.ts +++ b/memento-mobile/lib/config.ts @@ -1,6 +1,6 @@ // API base URL — change for dev/prod export const API_URL = __DEV__ - ? 'http://192.168.1.190:3000' // local network dev server + ? 'http://192.168.1.83:3000' // serveur de dev local : 'https://memento-note.com' export const ENDPOINTS = { diff --git a/memento-mobile/package-lock.json b/memento-mobile/package-lock.json index 957e614..2079bb7 100644 --- a/memento-mobile/package-lock.json +++ b/memento-mobile/package-lock.json @@ -18,6 +18,7 @@ "expo-splash-screen": "~31.0.13", "expo-status-bar": "~3.0.9", "lucide-react-native": "^0.477.0", + "marked": "^18.0.4", "react": "19.1.0", "react-native": "0.81.5", "react-native-safe-area-context": "~5.6.0", @@ -6225,6 +6226,18 @@ "tmpl": "1.0.5" } }, + "node_modules/marked": { + "version": "18.0.4", + "resolved": "https://registry.npmjs.org/marked/-/marked-18.0.4.tgz", + "integrity": "sha512-c/BTaKzg0G6ezQx97DAkYU7k0HM6ys0FqYeKBL6hlBByZwy+ycA1+f0vDdjMHKKeEjdgkx0GOv9Il6D+85cOqA==", + "license": "MIT", + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 20" + } + }, "node_modules/marky": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/marky/-/marky-1.3.0.tgz", diff --git a/memento-mobile/package.json b/memento-mobile/package.json index fa958c0..dfd86be 100644 --- a/memento-mobile/package.json +++ b/memento-mobile/package.json @@ -10,23 +10,24 @@ "build:ios": "eas build --platform ios" }, "dependencies": { + "@react-native-async-storage/async-storage": "2.2.0", "expo": "~54.0.35", - "expo-router": "~6.0.24", - "expo-status-bar": "~3.0.9", - "expo-secure-store": "~15.0.8", - "expo-font": "~14.0.12", - "expo-splash-screen": "~31.0.13", - "expo-linking": "~8.0.12", "expo-constants": "~18.0.13", + "expo-font": "~14.0.12", + "expo-linking": "~8.0.12", + "expo-router": "~6.0.24", + "expo-secure-store": "~15.0.8", + "expo-splash-screen": "~31.0.13", + "expo-status-bar": "~3.0.9", + "lucide-react-native": "^0.477.0", + "marked": "^18.0.4", "react": "19.1.0", "react-native": "0.81.5", "react-native-safe-area-context": "~5.6.0", "react-native-screens": "~4.16.0", + "react-native-svg": "15.12.0", "react-native-webview": "13.15.0", - "@react-native-async-storage/async-storage": "2.2.0", - "zustand": "^5.0.2", - "lucide-react-native": "^0.477.0", - "react-native-svg": "15.12.0" + "zustand": "^5.0.2" }, "devDependencies": { "@babel/core": "^7.25.2", @@ -34,4 +35,3 @@ "typescript": "~5.9.2" } } - diff --git a/memento-mobile/tsconfig.json b/memento-mobile/tsconfig.json index ed3ad5c..a74f665 100644 --- a/memento-mobile/tsconfig.json +++ b/memento-mobile/tsconfig.json @@ -3,8 +3,16 @@ "compilerOptions": { "strict": true, "paths": { - "@/*": ["./*"] + "@/*": [ + "./*" + ] } }, - "include": ["**/*.ts", "**/*.tsx", ".expo/types/**/*.d.ts", "expo-env.d.ts"] + "include": [ + "**/*.ts", + "**/*.tsx", + ".expo/types/**/*.d.ts", + "expo-env.d.ts", + ".expo/types/**/*.ts" + ] }