Brown-University-Library / ttwr

This is the django app that runs the Theater That Was Rome project website.
1 stars 5 forks source link

Cross-reference link in Markdown #164

Closed emylonas closed 8 years ago

emylonas commented 8 years ago

Transcribing from email: EM: Hi Ben - when you set up the django pages in the TTWR project that use markdown, you restricted what we can do in the pages. I'm running into some problems with internal links for some reason - is there some list of which version of md we are using? Also, it looks as if HTML tags work but nothing else?

Ben: Here's the way it's set up:

  1. it uses django-markdown-deux, version 1.0.4 - this is for rendering the markdown as html (using the python-markdown2 library).
  2. it uses django-pagedown, version 0.1.0 - this is for entering/previewing the markdown in the Admin.

I don't think there's any custom restrictions on what can be done on these pages - we're just using the package defaults. It looks like this link may have some tips on what's going on, and what needs to be enabled.

If you can send us a list of which tags you need, but don't currently work, we could look into what needs to be done to get it working. It might also be helpful to add some of the tags to a test object in worfdev.

emylonas commented 8 years ago

I've looked around a bit. First, more explanation: we are trying to mimic footnotes on a page in the markdown. In regular HTML this would be done by creating matched pairs of <a href="#foo" and <a name="foo"> elements.

In Markdown Extra and some other versions, this is done as follows: The link is indicated like this; [anchor-text](#foo) the anchor is indicated in regular HTML <a name="foo"></a> or``

I can get the initial link to work in our MD using this: [FT1](https://library.brown.edu/projects/rome/essays/testtest/#FT1) but not this: [FT1](#FT1)

However, this <a name="foo"></a> just shows up as a literal.

Is it possible to activate the anchor <a> element?

I'm using this essay to test

https://library.brown.edu/projects/rome/admin/rome_app/essay/36/

bcail commented 8 years ago

Elli, can you take a look at https://worfdev.services.brown.edu/projects/rome/essays/aldini/? Does that seem like it gives you what you need? If so, we'll have to look at it and see if we're OK with that solution.

emylonas commented 8 years ago

Yes, that's it. Thank you! --elli

bcail commented 8 years ago

update: I found a better solution. Please take a look at the aldini essay in worfdev again, to see how to do footnotes in markdown.

emylonas commented 8 years ago

I think this is ok - comments

  1. Usage: I put [^sometext] where the marker should appear and [^sometext]: footnote text follows at the beginning of a line somewhere else.
  2. I can put the footnote text directly following the reference, or in proximity to it, which is nice
  3. i tried putting a footnote reference on one of your lines that reads #MORE and that really borked it. But when i added it to some random non header text, it was fine. So no footnotes on headers.
  4. Footnotes only appear at the bottom of the page. this is probably not an issue.
  5. I found some documentation here: https://github.com/fletcher/MultiMarkdown/wiki/MultiMarkdown-Syntax-Guide that explains how to put markdown into footnotes. the instructions for a two paragraph footnote don't seem to work. I have successfully put in phrase level formatting. I'm confused about how to put a tab in front of the paragraph, as I can't input a tab into the field.
bcail commented 8 years ago

Here's the notes on this implementation of footnotes: https://github.com/trentm/python-markdown2/wiki/footnotes

emylonas commented 8 years ago

I see. No word about multiparagraph notes - still, it looks good.

bcail commented 8 years ago

I just enabled this in production. Please try it and let me know if there are issues.

emylonas commented 8 years ago

Ben - this was working - and it's working in the display part of the page where you edit the essay. However, on the web, for ex here: https://library.brown.edu/projects/rome/essays/flowerbook/ the link to a footnote in the text is not live, and it doesn't format properly. The actual footnotes themselves at the bottom of the page are missing the footnote marker and the first line of source text. All the footnote text together is wrapped in

 .

Was this something that snuck in when you updated TTWR?

bcail commented 8 years ago

yes, this was a problem from the upgrade. I've fixed it, and added an automated test to verify it.