-
Notifications
You must be signed in to change notification settings - Fork 20
feat(#62): markdown support for labels, hints, and constraint messages #511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
garethbowen
wants to merge
32
commits into
main
Choose a base branch
from
62-markdown
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
9f697f6
poc
garethbowen 7ccc1a6
day 2 poc
garethbowen 4892b83
most of markdown is working
garethbowen 2003aed
add more test types
garethbowen 2c0512a
more markup handled
garethbowen 435be16
format hints too
garethbowen 0379758
much cleanup, and supporting more cases
garethbowen 5d2ae7f
revert temporary package hack
garethbowen 92e5533
fix test
garethbowen 07639b1
fix test
garethbowen a1108b9
fix e2e test - labels no longer have spans inside
garethbowen ddcbb48
label must be a block elem now, bring * inline with first elem
garethbowen 83fe18f
remove check for asterisk which is applied via css now
garethbowen 8ea16a3
added a heap of testing and cleaned things up
garethbowen 8f86835
check for undefined
garethbowen bd5175a
fix test
garethbowen 1e56c7e
add test for jr:choice-name
garethbowen b0d3c00
fixed a bug with single quoted styles, and cleanup
garethbowen 748d0f4
add changeset
garethbowen 511193b
update the feature matrix
garethbowen 4ebe5f1
review feedback
garethbowen 15e5a46
fix test name
garethbowen 7c80160
review feedback
garethbowen 37fe793
modify test to allow labels to have inner elements
garethbowen 8380785
add non breaking spaces to test indentation
garethbowen 25901c5
update xlsx with list format instead of indentation
garethbowen a3a27af
fix label selector
garethbowen 1a1c11c
provide specific overrides for some central styles
garethbowen c114e34
use markdown for groups, repeats, and select options
garethbowen c9e9995
fix tests
garethbowen 21d2df0
markdown validation messages
garethbowen ebb6434
review feedback
garethbowen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
'@getodk/xforms-engine': minor | ||
'@getodk/web-forms': minor | ||
'@getodk/scenario': minor | ||
'@getodk/common': minor | ||
--- | ||
|
||
Added support for markdown formatting in labels, hints, and constraints |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
213 changes: 213 additions & 0 deletions
213
packages/common/src/fixtures/notes/3-notes-with-markdown.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,213 @@ | ||
<?xml version="1.0"?> | ||
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" | ||
xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" | ||
xmlns:jr="http://openrosa.org/javarosa" xmlns:orx="http://openrosa.org/xforms" | ||
xmlns:odk="http://www.opendatakit.org/xforms"> | ||
<h:head> | ||
<h:title>Notes</h:title> | ||
<model odk:xforms-version="1.0.0"> | ||
<itext> | ||
<translation lang="English"> | ||
<text id="q1:label"> | ||
<value>_Translated_</value> | ||
</text> | ||
<text id="/data/group/name:jr:constraintMsg"> | ||
<value>Must be **longer** than 3</value> | ||
</text> | ||
<text id="/data/group/selected:jr:requiredMsg"> | ||
<value>You must select _something_</value> | ||
</text> | ||
</translation> | ||
<translation lang="Español"> | ||
<text id="q1:label"> | ||
<value>_Traducida_</value> | ||
</text> | ||
</translation> | ||
</itext> | ||
<instance> | ||
<data id="notes" version="20240802121047"> | ||
<group> | ||
<headings /> | ||
<name/> | ||
<userentered/> | ||
<translated/> | ||
<selected/> | ||
<selectedminimal/> | ||
<dropdown/> | ||
<rank/> | ||
<note/> | ||
</group> | ||
<group2> | ||
<input/> | ||
</group2> | ||
<rep> | ||
<a>default value</a> | ||
</rep> | ||
<meta> | ||
<instanceID /> | ||
</meta> | ||
</data> | ||
</instance> | ||
<instance id="selectoptions"> | ||
<root> | ||
<item> | ||
<value>plain</value> | ||
<label>plain text</label> | ||
</item> | ||
<item> | ||
<value>strong</value> | ||
<label>**strong style**</label> | ||
</item> | ||
<item> | ||
<value>emphasis</value> | ||
<label>_italics_</label> | ||
</item> | ||
</root> | ||
</instance> | ||
<bind nodeset="/data/group/headings" readonly="true()" type="string" /> | ||
<bind nodeset="/data/group/name" type="string" constraint="string-length(.) > 2" | ||
jr:constraintMsg="jr:itext('/data/group/name:jr:constraintMsg')" required="true()" /> | ||
<bind nodeset="/data/group/userentered" readonly="true()" type="string" /> | ||
<bind nodeset="/data/group/translated" readonly="true()" type="string" /> | ||
<bind nodeset="/data/group/selected" type="string" required="true()" | ||
jr:requiredMsg="jr:itext('/data/group/selected:jr:requiredMsg')"/> | ||
<bind nodeset="/data/group/selectedminimal" type="string" /> | ||
<bind nodeset="/data/group/dropdown" type="string"/> | ||
<bind nodeset="/data/group/rank" type="rank"/> | ||
<bind nodeset="/data/group2/input" type="string"/> | ||
<bind nodeset="/data/rep/a" type="string" /> | ||
<bind nodeset="/data/group/note" readonly="true()" type="note" /> | ||
</model> | ||
</h:head> | ||
<h:body> | ||
<!-- need to test in other places, like validation, select item labels, etc --> | ||
<group appearance="field-list" ref="/data/group"> | ||
<input ref="/data/group/headings"> | ||
<label>You _can_ try this with other <span style="color:red;font-family:cursive">colours</span>; **most** primary colours should work.</label> | ||
</input> | ||
<input ref="/data/group/name"> | ||
<label>What's your name?</label> | ||
<hint>Type **your name** below</hint> | ||
</input> | ||
<input ref="/data/group/userentered"> | ||
<label>*You said:<span style="color:red;font-family:cursive"><output value="/data/group/dropdown" /></span>* but should it be markeddown?</label> | ||
</input> | ||
<input ref="/data/group/translated"> | ||
<label ref="jr:itext('q1:label')" /> | ||
</input> | ||
<group ref="/data/group2"> | ||
<label>*Groups*</label> | ||
<input ref="/data/group2/input"> | ||
<label>label</label> | ||
</input> | ||
</group> | ||
<group ref="/data/rep"> | ||
<label><span style="color:green">Repeat group</span></label> | ||
<repeat nodeset="/data/rep"> | ||
<input ref="/data/rep/a"> | ||
<label>Repeat input a</label> | ||
</input> | ||
</repeat> | ||
</group> | ||
<select1 ref="/data/group/selected"> | ||
<label>Select options</label> | ||
<itemset nodeset="instance('selectoptions')/root/item"> | ||
<value ref="value" /> | ||
<label ref="label" /> | ||
</itemset> | ||
</select1> | ||
<select1 appearance="minimal" ref="/data/group/selectedminimal"> | ||
<label>Select options minimal</label> | ||
<item> | ||
<label><span style="color:green">Yes</span></label> | ||
<value>yes</value> | ||
</item> | ||
<item> | ||
<label><span style="color:red">No</span></label> | ||
<value>no</value> | ||
</item> | ||
</select1> | ||
<select appearance="minimal" ref="/data/group/dropdown"> | ||
<label>Select multiple minimal</label> | ||
<item> | ||
<label><span style="color:green">Yes</span></label> | ||
<value>yes</value> | ||
</item> | ||
<item> | ||
<label><span style="color:red">No</span></label> | ||
<value>no</value> | ||
</item> | ||
</select> | ||
<odk:rank ref="/data/group/rank"> | ||
<label>Rank this <em>stuff</em></label> | ||
<item> | ||
<label><span style="color:green">Green</span></label> | ||
<value>A</value> | ||
</item> | ||
<item> | ||
<label><span style="color:red">Red</span></label> | ||
<value>B</value> | ||
</item> | ||
<item> | ||
<label><span style="color:blue">Blue</span></label> | ||
<value>C</value> | ||
</item> | ||
<item> | ||
<label><span style="color:yellow">Yellow</span></label> | ||
<value>D</value> | ||
</item> | ||
</odk:rank> | ||
<input ref="/data/group/note"> | ||
<label> | ||
# heading 1 | ||
## heading 2 | ||
### heading 3 | ||
#### heading 4 | ||
##### heading 5 | ||
###### heading 6 | ||
|
||
&nbsp;&nbsp;&nbsp;&nbsp;Indented text | ||
|
||
[get odk](http://www.getodk.org) | ||
<br/><br/> | ||
Escaping: \*hello\* | ||
<br/><br/> | ||
<span style="color:red;font-family:cursive">signature</span> | ||
<br/><br/> | ||
|
||
<p style="text-align:center"> | ||
centered paragraph | ||
</p> | ||
|
||
<br/><br/> | ||
|
||
|
||
<div style="text-align:center">centered div</div> | ||
|
||
<table border="1"> | ||
<tr> | ||
<td>name</td> | ||
<td>value</td> | ||
</tr> | ||
<tr> | ||
<td>once</td> | ||
<td>twice</td> | ||
</tr> | ||
</table> | ||
|
||
- unordered list 1 | ||
- unordered list 5 | ||
- unordered list 3 | ||
|
||
|
||
1. ordered list 1 | ||
2. ordered list 2 | ||
3. ordered list 3 | ||
|
||
_styles **can <span style="color:red;">be</span> nested** inside_ | ||
|
||
</label> | ||
</input> | ||
</group> | ||
</h:body> | ||
</h:html> |
24 changes: 12 additions & 12 deletions
24
packages/common/src/fixtures/preview-service/xforms/all-question-types-v2024091201-3.xml
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file modified
BIN
+2.51 KB
(110%)
packages/common/src/fixtures/preview-service/xlsforms/all-question-types-v2024091201-3.xlsx
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.