{"id":31562593,"url":"https://github.com/aphp/prism-lang-fml","last_synced_at":"2025-10-05T04:14:14.682Z","repository":{"id":315953313,"uuid":"1061352961","full_name":"aphp/prism-lang-fml","owner":"aphp","description":"A Prism.js language definition plugin for FHIR Mapping Language (FML)","archived":false,"fork":false,"pushed_at":"2025-09-21T19:19:43.000Z","size":50,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-21T21:19:39.838Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aphp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-21T18:31:22.000Z","updated_at":"2025-09-21T19:19:47.000Z","dependencies_parsed_at":"2025-09-21T21:19:41.838Z","dependency_job_id":"4aa30d07-a612-437b-a015-86feeef1e98d","html_url":"https://github.com/aphp/prism-lang-fml","commit_stats":null,"previous_names":["aphp/prism-lang-fml"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/aphp/prism-lang-fml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aphp%2Fprism-lang-fml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aphp%2Fprism-lang-fml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aphp%2Fprism-lang-fml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aphp%2Fprism-lang-fml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aphp","download_url":"https://codeload.github.com/aphp/prism-lang-fml/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aphp%2Fprism-lang-fml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278406897,"owners_count":25981708,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-05T04:14:10.302Z","updated_at":"2025-10-05T04:14:14.673Z","avatar_url":"https://github.com/aphp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# prism-lang-fml\n\nA Prism.js language definition plugin for FHIR Mapping Language (FML)\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md)\n[![Prism.js Compatible](https://img.shields.io/badge/Prism.js-Compatible-purple.svg)](https://prismjs.com)\n[![FHIR R5](https://img.shields.io/badge/FHIR-R5-blue.svg)](https://hl7.org/fhir/R5/)\n\n## 📋 Overview\n\nThis project provides a comprehensive language definition plugin for [Prism.js](https://prismjs.com), enabling syntax highlighting for **FHIR Mapping Language (FML)** files. FML is a domain-specific language for transforming data between different FHIR resource formats, essential for healthcare interoperability.\n\n## 🚀 Features\n\n- **Complete FML syntax support** - All keywords, operators, and constructs\n- **Comprehensive token highlighting** - Metadata comments, transformation arrows, functions\n- **FHIR-aware patterns** - URLs, paths, ConceptMaps, structure definitions\n- **Performance optimized** - Regex patterns designed to avoid backtracking\n- **Compatible with Prism.js 1.15+** - Works with all modern Prism.js versions\n- **Extensive test coverage** - 50+ test cases covering all FML features\n- **Visual testing** - Interactive demo for real-time syntax verification\n\n## 📁 Project Structure\n\n```\nprism-lang-fml/\n├── src/\n│   ├── prism-lang-fml.js      # Main language definition\n│   └── prism-lang-fml.css     # Optional fml styling\n├── test/\n│   ├── fixtures/                 # Test code samples\n│   ├── prism-lang-fml.test.js # Unit tests\n│   └── visual.html               # Visual testing page\n├── examples/\n│   └── demo.html                 # Usage examples\n├── dist/                         # Built/minified files\n│   ├── prism-lang-fml.min.js\n│   └── prism-lang-fml.min.css\n├── docs/\n│   └── LANGUAGE_SPEC.md         # Language specification\n├── .github/\n│   ├── workflows/               # CI/CD pipelines\n│   ├── ISSUE_TEMPLATE/\n│   └── PULL_REQUEST_TEMPLATE.md\n├── CONTRIBUTING.md              # Contribution guidelines\n├── CLAUDE.md                    # Claude Code assistant guide\n├── LICENSE                      # MIT License\n├── package.json\n├── .gitignore\n├── .eslintrc.json\n└── README.md                    # This file\n```\n\n## 🔧 Installation\n\n### Using npm\n\n```bash\nnpm install prism-lang-fml\n```\n\n### Using CDN\n\n```html\n\u003c!-- Include Prism.js core --\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/prismjs@1.30.0/prism.min.js\"\u003e\u003c/script\u003e\n\n\u003c!-- Include the language definition --\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/prism-lang-fml@0.1.0/prism-lang-fml.min.js\"\u003e\u003c/script\u003e\n```\n\n### Manual Installation\n\n1. Download the plugin files from the `dist/` directory\n2. Include them in your HTML after Prism.js core\n\n## 📖 Usage\n\n### Basic Usage\n\n```html\n\u003cpre\u003e\u003ccode class=\"language-fml\"\u003e\n/// url = 'http://example.org/fhir/StructureMap/PatientTransform'\n/// name = 'PatientTransformation'\n\nmap \"PatientTransform\" = \"Transform\"\n\nuses \"http://hl7.org/fhir/StructureDefinition/Patient\" alias Patient as source\nuses \"http://hl7.org/fhir/StructureDefinition/Bundle\" alias Bundle as target\n\ngroup TransformPatient(source src : Patient, target tgt : Bundle) {\n  src.id as id -\u003e tgt.id = id \"copyId\"\n  src.name as n where n.use = 'official' -\u003e tgt.displayName = n\n  src.gender as g -\u003e tgt.genderCode = translate(g, '#GenderMap', 'code')\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cscript\u003e\n  // Highlight all code blocks\n  Prism.highlightAll();\n\u003c/script\u003e\n```\n\n### Advanced Usage\n\n```javascript\n// Programmatic highlighting\nconst fmlCode = `\n  src.identifier as id where id.system = 'http://example.org/mrn' then {\n    id -\u003e tgt.identifier = create('Identifier') as newId then {\n      id.value as v -\u003e newId.value = v \"setValue\"\n      id -\u003e newId.system = 'http://newexample.org/mrn' \"setSystem\"\n    }\n  }\n`;\n\nconst html = Prism.highlight(fmlCode, Prism.languages.fml, 'fml');\n```\n\n### Supported Token Types\n\nThe plugin recognizes and highlights the following FML constructs:\n\n| Token Type               | Description                   | Example                           |\n| ------------------------ | ----------------------------- | --------------------------------- |\n| `metadata-comment`       | Metadata declarations         | `/// url = 'http://example.org'`  |\n| `structure-keyword`      | Structure definition keywords | `map`, `uses`, `group`, `imports` |\n| `mode-keyword`           | Parameter mode keywords       | `source`, `target`, `queried`     |\n| `transformation-keyword` | Transformation operations     | `for`, `where`, `check`, `then`   |\n| `function`               | Built-in functions            | `create()`, `translate()`, `cc()` |\n| `transformation-arrow`   | Transformation operator       | `-\u003e`                              |\n| `rule-label`             | Named rule labels             | `\"copyId\" :`                      |\n| `variable-binding`       | Variable binding keyword      | `as`                              |\n| `url`                    | HTTP/HTTPS URLs               | `http://hl7.org/fhir/Patient`     |\n| `path`                   | Path expressions              | `src.patient.name.family`         |\n| `operator`               | Logical/comparison operators  | `=`, `!=`, `and`, `or`            |\n| `string`                 | String literals               | `'Patient'`, `\"Bundle\"`           |\n| `number`                 | Numeric literals              | `42`, `3.14`                      |\n| `boolean`                | Boolean values                | `true`, `false`                   |\n\n## 🧪 Development\n\n### Prerequisites\n\n- Node.js \u003e= 16.0.0\n- npm \u003e= 7.0.0\n- Git\n\n### Setup\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/yourusername/prism-lang-fml.git\ncd prism-lang-fml\n```\n\n2. Install dependencies:\n\n```bash\nnpm install\n```\n\n3. Start development:\n\n```bash\nnpm run dev\n```\n\n### Available Scripts\n\n- `npm run dev` - Start development mode with watch\n- `npm run build` - Build production files\n- `npm test` - Run tests\n- `npm run lint` - Lint code\n- `npm run format` - Format code with Prettier\n- `npm run test:visual` - Open visual test page\n\n## 🤝 Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details on:\n\n- Code of Conduct\n- Development workflow\n- Submitting pull requests\n- Reporting issues\n\n## 🐛 Issues\n\nFound a bug or have a feature request? Please check [existing issues](https://github.com/yourusername/prism-lang-fml/issues) first, then [open a new issue](https://github.com/yourusername/prism-lang-fml/issues/new/choose) if needed.\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 🙏 Acknowledgments\n\n- [Prism.js](https://prismjs.com) team for the excellent syntax highlighter\n- [HL7 FHIR](https://hl7.org/fhir/) community for the FHIR specification\n- [FHIR Mapping Language](https://build.fhir.org/mapping-language.html) specification authors\n- Contributors and maintainers\n- Healthcare interoperability community\n\n## 📚 Resources\n\n### FML Language Resources\n\n- [FHIR Mapping Language Specification](https://build.fhir.org/mapping-language.html)\n- [FHIR Mapping Language Grammar](https://build.fhir.org/mapping.g4)\n- [FHIR Mapping Tutorial](https://build.fhir.org/mapping-tutorial.html)\n- [StructureMap Resource](https://build.fhir.org/structuremap.html)\n- [FHIRPath Specification](http://hl7.org/fhirpath/)\n\n### Prism.js Resources\n\n- [Prism.js Documentation](https://prismjs.com/docs/)\n- [Creating a Prism.js Language Definition](https://prismjs.com/extending.html#language-definitions)\n- [Language Definition Examples](https://github.com/PrismJS/prism/tree/master/components)\n\n## 🔗 Links\n\n- [npm Package](https://www.npmjs.com/package/prism-lang-fml)\n- [GitHub Repository](https://github.com/yourusername/prism-lang-fml)\n- [Issue Tracker](https://github.com/yourusername/prism-lang-fml/issues)\n- [Discussions](https://github.com/yourusername/prism-lang-fml/discussions)\n\n### 📊 Implementation Status\n\n- ✅ **Language Definition**: Complete FML syntax support with 15+ token types\n- ✅ **Testing**: 50+ comprehensive test cases covering all FML features\n- ✅ **Documentation**: Complete language specification and usage examples\n- ✅ **Performance**: Optimized regex patterns, no catastrophic backtracking\n- ✅ **Visual Testing**: Interactive demo with theme switching and real-time testing\n- ✅ **Build System**: Production-ready build pipeline with minification\n\n### 🎯 Supported FML Features\n\n- **Structure Definitions**: `map`, `uses`, `group`, `imports`, `extends`, `alias`, `conceptmap`\n- **Mode Keywords**: `source`, `target`, `queried`, `produced`\n- **Transformations**: `for`, `where`, `check`, `then`, `first`, `last`, `only_one`\n- **Functions**: All 17+ built-in functions (`create`, `translate`, `cc`, `qty`, etc.)\n- **Special Syntax**: Transformation arrows (`-\u003e`), rule labels, variable binding (`as`)\n- **Data Types**: URLs, paths, strings, numbers, booleans\n- **ConceptMaps**: Full prefix and mapping syntax support\n\nReady for FHIR developers building healthcare interoperability solutions! 🏥\n\n---\n\n**Status**: ✅ **Ready for Production** - Complete FML syntax highlighting implementation\n\npartially developped with Claude Code\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faphp%2Fprism-lang-fml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faphp%2Fprism-lang-fml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faphp%2Fprism-lang-fml/lists"}