Anne Lister (Suranne Jones) and Ann Walker (Sophie Rundle) in a scene from Gentleman Jack, the forthcoming TV drama series written and directed by Sally Wainwright.
Photograph: Matt Squire/Lookout Point

She was a 19th-century pioneer in many fields: business, travel, mountaineering. But 178 years after her death, Anne Lister is best known for her string of female lovers, with their erotic encounters explicitly chronicled in a coded diary stretching to 27 volumes.

Last week, the woman often referred to as the “first modern lesbian” was honoured with a blue plaque at Holy Trinity church in Goodramgate, York. The medieval church had sealed Lister’s de facto marriage to a woman when the couple took communion at its altar.

The plaque, which celebrates a “gender-nonconforming entrepreneur”, is the first in the UK to be bordered with rainbow colours in recognition of lesbian, gay and trangender history.

Next year the BBC will screen an eight-part TV drama about Lister’s life and loves, written and directed by Sally Wainwright, whose credits include Happy Valley and Last Tango in Halifax. The series, Gentleman Jack - Lister’s nickname, a result of her penchant for dark, masculine clothing - is being filmed in Yorkshire with a cast led by Suranne Jones and including Sophie Rundle and Timothy West.

“Bringing Anne Lister to life with all her complexity, passion, brilliance and wit is an epic challenge,” Wainwright told the Radio Times last year when the series was announced.

Edged with a rainbow border, the first LGBT memorial plaque in the UK was unveiled at Holy Trinity church in York to Anne Lister (1791-1840), who ‘married’ her lesbian lover in the church in 1834.

She came from one of the most prominent families in Halifax, whose estate, Shibden Hall, dating from the 15th century, is now a tourist attraction. As a result of the deaths of her four brothers, Lister inherited the family seat in 1826, eventually restoring and renovating the house and landscaping the grounds.

By then, Lister had experienced at least four serious lesbian love affairs. The first, which began when she was 15, set a pattern of overlapping, passionate relationships. As a teenager she began recording her love life in diaries which eventually amounted to four million words.

In 1834, Ann Walker, an heiress to a neighbouring estate in Yorkshire, moved in to Shibden Hall where she and Lister lived openly as a couple. But Lister, a Christian, wanted their union blessed by God.

“She never experienced any difficulty in reconciling her lesbian sexuality with her Christianity,” said Helena Whitbread, who has studied Lister’s diaries for 35 years and is writing a biography. “Her firm belief was that as God had endowed her with her sexual nature, it would be wrong to act against it.”

On Easter Sunday, Lister and Walker – who had exchanged vows and rings – took communion together at Holy Trinity. In Lister’s eyes, said Whitbread, the sacramental act “sealed the matrimonial pact in which they had entered”. The church has now become “an icon for what is interpreted as the site of the first lesbian marriage to be held in Britain.”

Five years later, the two women set off on a European tour. In Georgia, Lister developed a fever after being bitten by an insect and died at 49 in September 1840. Walker had her body embalmed and returned to Yorkshire.

Her diaries remained hidden for almost 50 years, until a descendant, John Lister, who had inherited Shibden Hall, found them and broke the code derived from algebra and the Greek alphabet. The sexually explosive content so alarmed Lister –who was clandestinely gay – that he returned the diaries to their hiding place.

Detail from a portrait of Anne Lister by Joshua Horner, circa 1830. The portrait is on display at Shibden Hall. Photograph: The History Collection/Alamy

They were rediscovered in the following century when Shibden Hall opened as a museum. The bulk of the journals recorded Lister’s daily life and network of acquaintances – an extraordinarily detailed social history giving an intimate glimpse into the Georgian era. Her “depiction of Halifax resembles a cross between [the 19th century novel] Cranford and Jane Austen,” according to Whitbread.

But when the code – which accounted for about a sixth of the diaries, and was referred to Lister as “my crypthand” – was rebroken in the 1980s, Lister’s passionate love life was revealed. “It is groundbreaking stuff, absolutely explicit, every action is described. It’s very saucy and very riveting,” said Whitbread. “Most of the women Lister seduced were straight, but they were very happy to get back into bed with her.”

In 2011, Lister’s journals were recognised by Unesco as a “pivotal document” in British history and added to the Memory of the World register. The diaries were “a comprehensive and painfully honest account of lesbian life,” said the UN cultural body.

Kit Heyam, one of the activists who campaigned for the plaque, said Lister’s story was “enormously significant because she is one of the first people for whom there is documentary evidence of what she saw as a queer marriage”.

Heyam added: “She also saw no conflict between her Christian faith and her sexuality. And an important part of her legacy was her gender non-conformity. Nowadays we tend to separate sexuality and gender, but historically, as Anne Lister shows, it was intertwined.”

York Civic Trust, which erected the plaque in partnership with lesbian, gay and trangender organisations in York and the Churches Conservation Trust, said there had been “a lot of discussion but no controversy” about the memorial. “There is no doubt that York has an LGBT history that should be recognised,” said the chief executive, David Fraser.

Lister’s “marriage” took place 180 years before same-sex unions became legal in the UK. Despite the change in the law and shifting social attitudes, the Church of England does not permit or recognise such ceremonies, nor allow its clergy to bless same-sex couples who have undergone a civil marriage.

However, Holy Trinity was declared redundant in 1971 and is now one of 353 churches in the care of the conservation trust. “We strive to make our churches as inclusive as possible and we support celebrations of love,” said Anthony Bennett, its director of development.